Utility program 04   Update   2017-07-23
<a name=index>
copy html page table data to text string. (copyScreen) Show; document;
update 2017-02-08 program and document
Count characters and sequential display Unicode
none-sequential (random) display
URL add link if input http://ab.org/old.jpg
output http://ab.org/<a href=old.jpg>old.jpg</a>
output <a href=http://ab.org/old.jpg>http://ab.org/old.jpg</a>

One equation apply to number sequence
Two equation apply to four number sequence complex sin(a+ib)*cos(c+id)
in which a,b,c,d are variables, number array input, number array output.
Extract Unicode from input string.
test function change bye09err(-0.9999999)=1 to bye09(-0.9999999)=-1

<a name=copyScreen>
2015-01-12-16-51 start programming ;
Program function document
<tr> , <td> definition box.
<tr>  : , ; program convert all <sTrInG> to lowercase <string>.
<td> : , ; user can change four boxes for possibly other application.
BUT program structure work on <tr> <td> data1 </td> <td> data2 </td> </tr>

Box 11   input   Click [Copy Screen] to run

RUN ⇒ ; ; [tr] line mustHave , , ;example ; ; ;
del newline in <td> newline </td> ; del "<a href=..." in <td> data </td> ;
[td] separator [td] , ; '\t'=tab. ; [tr] separator [tr] , ; '\n'=newline.
columnSequence ; del ; ; normal ;
Box 12 output   If no output, click [d1] delete mustHave.

see example 1,2,3 table display.

Box 18 debug

<a name="a40118a">
2015-01-18-16-38 start 
On 2015-01-11 brother ask LiuHH write a program 
to extract data from html file <table> </table>
LiuHH wrote a program do this job, and upload 
to http://freeman2.com/utility4.htm
utility4.htm is half what brother asked for. 
Later need modify utility4.htm example 01 
output. Those modification is not useful to 
general public. Later modification will NOT 
upload to Internet. 

<a name="a40118b">
Assume input 
<tr> <td> data1 </td> <td> data2 </td> <td> data3 </td> </tr> 
<tr> <td> data4 </td> <td> data5 </td> <td> data6 </td> </tr> 
Program output to 
data1 data2 data3 newline 
data4 data5 data6 
data1 and data4 are column0; data2 and data5 are column1, 
data3 and data6 are column2. User can switch output columns 
from 0,1,2 to 2,0,1 (for example) by assign 201 to 
columnSequence box. If box data has repeat like 201314, 
program use 0123456789abcdefghijklmnopqrstuvwxyz 
"012...xyz" represent column number in input html file order 
9 is column 10, 'a' is column 11, 'z' is column 36 etc. 
Although LiuHH assume program take care of 36 columns, but 
did not test run. 
<a name="a40118c">
Drop column 0134 accepted , but repeat column 201314 ignored.
If column sequence 0123456 has mustHave string '$' at column3. 
If use columnSequence 2016453, program send output to box2.
If use columnSequence 201645, column 3 mustHave string '$' 
dropped, then program NOT send output to box2. In this case 
click [d1] button right to mustHave box.

<a name="a40118d">
Example 01,02,03 three click buttons, 01 is the one brother 
requested. But this 01 example is disguised. Without fill in 
data to mustHave box. Click [Copy Screen] button, Box 12 output 
several not related rows. If fill in '$' to mustHave box, those 
rows without '$' will be deleted from Box 12 output. 
2015-01-18-17-10 stop

<a name="a40118e">
2015-01-18-19-50 start 
2015-01-18-17-15 added <tr> , <td> definition box. 
If use example 02 click [Copy Screen] get 
5/8	5/8 text	
&#8541;	⅝ text	
<sup>5</sup>/<sub>8</sub>	5/8 text	
5&#8260;8	5⁄8 text

<a name="a40118f">
If use example 02 change 
from <td> : [<td ] , [</td ] ;  
to   <td> : [<th ] , [</th ] ;  
click [Copy Screen] get next 
Approach	HTML notation	Appearance	
Linear notation	Special character	
Special character	sup and sub	
sup and sub	Fraction slash	
Fraction slash	Fraction slash and CSS	
Fraction slash and CSS

<a name="a40118g">
First time run example 02 got infinite loop. 
Got infinite loop, because example 02 has 
<tr> <th> data1 </th> <th> data2 </th> <th> data3 </th> </tr> 
instead of 
<tr> <td> data1 </td> <td> data2 </td> <td> data3 </td> </tr> 

Got infinite loop, because example 02 has 
<tr> <td> data1 <td> data2 <td> data3 </tr> 
instead of 
<tr> <td> data1 </td> <td> data2 </td> <td> data3 </td> </tr> 

Later modified and get output. 

<a name="a40118h">
Below has a Display section. 
Click button [01], [02], [03] page display 
default sample table. Later added 
Display Box 11 [<table>] [<body>]. 
If click [<table>], page display user defined 
input string at Box 11, 
from first <table> to last </table>
If click [<body>], page display user defined 
input string at Box 11, 
from [<body>] to [</body>]
<a name="a40118i">
Box 11 is far away from display section. 
Later added Display Box 17 [<table>] [<body>]. 
same as Display Box 11, except read input 
from Box 17. 
NOT all input displayed, example 02 input 
string only [<table>] work, but [<body>] fail. 
Liu,Hsinhan did not find out how to solve this 
2015-01-18-20-16 stop 

Box 17 debug

<a name=copyScreenShow>
2015-03-11-21-08 to 2015-03-11-21-18 add next three lines.
Paste your html source code to Box 17 above. Then
click [<table>] button, display your code from first <table> to last </table>
click [<body>] button, display your code from first <body> to last </body>

Display Box 17 ;

If you have your html source code in Box 11 above. Then
click [<table>] button or click [<body>] button, show html code below.

Show example ; ; ; delete ; 01,02,03 user has no control;

<table> <body> read user input at box 11,17.
Display Box 11 ;
If <table> to </table> code and <body> to </body> code contain <script>
<table> to </table> code and <body> to </body> code not always display.

<a name="charCountBox">
Count characters, only character in begin/end range will be counted. If
begin/end=9/256, input "Γ(z)=Gamma function", 'Γ' is NOT counted.

sequential display Unicode, none-sequential (random) display
Unicode begin number , end number
; ;
Box10, input
Box11, found count

Box12, skip count
Box13, all count

<a name="showUnicode">
If you have a unicode character 'ΓΔ' in hand, and hope to find other related
characters 'ΣΤΥΦΧΨΩ'. You need to know 'ΓΔ' unicode number, then use
display Unicode function to get other characters. Paste 'ΓΔ' to Box 20 below
then click [skip keyboard char] button, from Box 21 read "Γ"=&#915;
"Δ"=&#916; Next goto display Unicode Box 01 above. Fill trial number
to Unicode begin number [900], end number [999] then click [charShow()]
"Box11" box will list more similar unicode for you. 2015-03-11-23-00

show UniCode, none-sequential   sequential output
  "keyboard char" mean &#32;=' ', &#33;='!' ...
&#48;='0' ... &#65;='A' ... &#90;='Z' ... &#126;='~'
; control char has tab=&#9; newline &#13; etc.

Box20, input
Box21, output
Liu,Hsinhan busy two hours hope from "ℂ ℍ ℕ ℙ ℚ ℝ ℤ " find hollow 'W' .
But no hollow 'W' unicode. texblog.org/2007/08/27/number-sets... say
hollow 'W' is whole numbers. 2015-03-11-23-42
ℂ complex numbers
ℍ Hello
ℕ natural numbers
ℙ prime numbers
ℚ rational numbers
ℝ real numbers
ℤ integers

Box24,Box25,Box26 come from http://freeman2.com/a/biogm001.htm#box13
addlink code improved in http://freeman2.com/utility5.htm
<a name="box24">
Link file name, if input http://ab.org/old.jpg
output http://ab.org/<a href=old.jpg>old.jpg</a>
Link URL,output <a href=http://ab.org/old.jpg>http://ab.org/old.jpg</a>
link URL without file name RUN Link URL
On the other hand URL without file name no link RUN link file name only
Box 24, input ;   Link URL document

RUN Box 25 output link URL without file name, click [BB] include [:/]
,file name extension ;next line
,file name char.
Box 25,output ;  ERROR why link again? (error)

If input do not have <a href= ... </a> string, you can click to get correct answer.
Box 26,debug ; ; Link URL document

QBboxa26.value=''; function addlink_evenIfRepeat(arg1,arg2,arg3)
Box24,Box25,Box26 come from http://freeman2.com/a/biogm001.htm#box13
addlink code improved in http://freeman2.com/utility5.htm
update 2017-02-08 link all URLs.

<a name=box60>
One equation apply to number sequence
2017-03-25-00-55 question gap=2 prime pair middle value number sequence,
it has what characteristic? 2017-03-25-01-00 begin code.
Box 60, input ; Example, gap=,,,, prime pair's middle value

One equation , , , ,
Box 61,output ; RUN Output to Box 61。

QBboxa61.value='' ; a603250213 done code.
gap=2 prime pair 5,7; 11,13; 17,19; 29,31; 41,43... middle are 6,12,18,30,42...
all divide by six get 1,2,3,5,7... What is the characteristic of this number sequence ?
How to prove gap 2 prime pair middle number sequence extend to infinity?
How about gap 4 prime pair middle number sequence ?
gap=what prime pair middle number sequence is first finite sequence ? a603261352

<a name=bx6263>
Two equation apply to four number sequence
Click Example [01] ,[02] read Box67 brief. Click RUN [calculat0] output to Box66.
Box62, input a ; split62 ,
Box63, input b array
split62 and split64 are useful if you paste (x,y) to Box62, Box64. Example 01 ,02 data do NOT click [↔] , [↕] !
Box64, input c ; split64 ,
Box65, input d array
Equation variables allow a,b,c,d . value a from [Box62, input a array], d from [Box65, input d array]
eqn01 , , , ,
eqn02 , , Example ,
RUN Output to Box 66. ; Split66 (x,y) , to Box 66 [x], Box 67 [y]
Box66, output , eqn01 answer
Box67, output , eqn02 answer
'm=' and 'n=' are dummy, [m=a/6] and [sky=a/6] and [a/6] are the same
2017-05-08-17-32 begin write "Two equation apply to four number sequence"
2017-05-10-21-20 done

<a name=extractUnicode> Extract Unicode from input string.
2017-06-20-22-11 start
2017-06-20-20-44 Liu,Hsinhan access
hope copy screen text and extract Unicode from screen text. Write the following utility.
Unicode &#32; is keyboard ' '. Unicode &#255; is ANSI code end. Unicode &#19968; is
Chinese dictionary first character. Unicode &#40869; is Chinese dictionary last character.
Math symbol start from &#8701; to &#8995; Full width alphabet start from &#65281;
to &#65375; Unicode last symbol is &#65535; . Liu,Hsinhan 劉鑫漢 2017-06-20-22-46

, ; , , output change line
focus Unicode start 1 :focus Unicode stop 1
focus Unicode start 2 :focus Unicode stop 2
Box68 input, extract Unicode RUN ; output to Box69。
Box68, input
Box69, output
QBboxc69.value='' ;

Test javascript functions
This program let user test javascript function. If function is build in
to current html file, just enter function name to funcName [Box]
User supply arguments to Box72 these arguments should be compatible
with function tested.
Click button [cut09] call a build-in function cut09().
cut09() is same as bye09(), cut09() is defined, but bye09() is not defined.
Click button [addme] illustrate Box72 one line one test run.
If function is NOT build in, copy/paste function definition to Box71
and supply proper function arguments in Box72. Fill Box71 function
name to funcName [Box] , then click RUN 01 ☞ [test Func.] output to
Box73. Try Sample Arg. [d0] ; Sample func. [bye09] , ill func. [09err]
This utility help Liu,Hsinhan find out [09err] bye09err(-0.9999999)=1
error. Correction made and [bye09] bye09(-0.9999999)=-1 is correct.
Choose proper test point in Box72 , that is important.

Box71 define function ;

Sample Arg. ; Sample func. , ill func. ; click [test Func.]
Box72 define input arguments ; Box73 output in one line.

funcName silver box name bye09 is not defined.
Box73 output ; Sample F1 , RUN 01 ☞

QPboxc71.value='' ;

<a name=a60508a>
complex power 
  exp(z) = exp(x+iy) = exp(x)*exp(iy) = 
  exp(x)*(cos(y) + i*sin(y)) 

   =  sin(x)*[exp(-y)+exp(+y)]/2
   +i*cos(x)*[exp(+y)-exp(-y)]/2  ---(CS4)

   =  cos(x)*[exp(-y)+exp(+y)]/2
   -i*sin(x)*[exp(+y)-exp(-y)]/2 ---(CC3)

<a name=a60508b>

={ sin(x)*[exp(-y)+exp(+y)]/2
 { cos(s)*[exp(-t)+exp(+t)]/2
<a name=a60508c>
{{ sin(x)*[exp(-y)+exp(+y)]/2}
*{ cos(s)*[exp(-t)+exp(+t)]/2}
{{ sin(x)*[exp(-y)+exp(+y)]/2}
*{ cos(s)*[exp(-t)+exp(+t)]/2}}

<a name=a60508d>
x to a; y to b; s to c; t to d 
{{ sin(a)*[exp(-b)+exp(+b)]/2}
*{ cos(c)*[exp(-d)+exp(+d)]/2}
{{ sin(a)*[exp(-b)+exp(+b)]/2}
*{ cos(c)*[exp(-d)+exp(+d)]/2}}

<a name=a60508e>
[ to (; ] to ); { to (; } to ) 
{( sin(a)*(exp(-b)+exp(+b))/2)
*( cos(c)*(exp(-d)+exp(+d))/2)
(( sin(a)*(exp(-b)+exp(+b))/2)
*( cos(c)*(exp(-d)+exp(+d))/2))

<a name=a60508f>
real+i*imag to m+i*n
m= //real
 ( sin(a)*(exp(-b)+exp(+b))/2)
*( cos(c)*(exp(-d)+exp(+d))/2)

n= //imag  +i*
  ( sin(a)*(exp(-b)+exp(+b))/2)
*( cos(c)*(exp(-d)+exp(+d))/2)

<a name=a60508g>
m= //real '20(' and '20)' //'20(' say 20 count '('
 ( sin(a)*(exp(-b)+exp(+b))/2)*( cos(c)*(exp(-d)+exp(+d))/2)-(cos(a)*(exp(+b)-exp(-b))/2)*(-sin(c)*(exp(+d)-exp(-d))/2)
n= //imag  +i*,  '20(' and '20)'
  ( sin(a)*(exp(-b)+exp(+b))/2)*(-sin(c)*(exp(+d)-exp(-d))/2)+(cos(a)*(exp(+b)-exp(-b))/2)*( cos(c)*(exp(-d)+exp(+d))/2)

<a name=a60508h>
m= //real '20(' and '20)'
 ( sin(vary1)*(exp(-vary2)+exp(+vary2))/2)*( cos(vary3)*(exp(-vary4)+exp(+vary4))/2)-(cos(vary1)*(exp(+vary2)-exp(-vary2))/2)*(-sin(vary3)*(exp(+vary4)-exp(-vary4))/2)
n= //imag  +i*,  '20(' and '20)'
  ( sin(vary1)*(exp(-vary2)+exp(+vary2))/2)*(-sin(vary3)*(exp(+vary4)-exp(-vary4))/2)+(cos(vary1)*(exp(+vary2)-exp(-vary2))/2)*( cos(vary3)*(exp(-vary4)+exp(+vary4))/2)

<a name=a60508i>
utility4.htm Example 02 input to box62,63,64,65 
box62 10th data 0.9   ; box63 10th data 0.434
box64 10th data 0.858 ; box65 10th data 0.278
RUN [calculat0] Output to Box 66. 10th data is 

2017-05-09-19-19 cplxdraw.htm input to Box34 
Click [evaluateBox34] get answer to Box35 
confirmed same answer. 

<a name=a60207a>
At Box 24 find Link URL program.

If input http://ab.org/old.jpg
Link file name only output http://ab.org/<a href=old.jpg>old.jpg</a>
Link URL output <a href=http://ab.org/old.jpg>http://ab.org/old.jpg</a>
link URL without file name RUN Link URL On the other hand
URL without file name no link RUN link file name only
If click RUN  get correct output. But, 
if click  get wrong output. Explain as 

<a name=a60207b>
Link URL code use two functions 
main function addlink_evenIfRepeat(arg1,arg2,arg3)
aux. function addlink_noRepeat(arg1,arg2,arg3)
main function really Link URL which is uploaded 
on 2017-01-09 (Chinese version utility5.htm) 
That time main function name addlink0(arg1,arg2,arg3)
main function link URL in two categories.
First category is URL include file name.
http://g3.com/h6.jpg or d710823a.jpg
Second category is URL without file name.
example http://f2.com/
First category identify file name refer to 
user defined file name extension
 ☜ file name extension definition Box 
input string http://j6.com/a.bcd not add link,
because file name extension define Box not 
include bcd.
input string d710823a.JPG not add link, because 
file name extension JPG use uppercase, but 
extension definition Box define lowercase jpg .

<a name=a60207c>
Above is file name extension definition Box. 
Following is link URL without file name or 
URL without file name no link 
checkBox which also control code behaviors.
link URL without file name, click [BB] include [:/] 
If check Box 
link URL without file name,program RUN Link URL ,
Change input http://j6.com/ to 
<a href=http://j6.com/>http://j6.com/</a>
Change input http://j6.com/a.bcd to 
<a href=http://j6.com/a.bcd>http://j6.com/a.bcd</a>

<a name=a60207d>
On the other hand, if clear checkBox 
URL without file name no link ,program run 
link file name only 
Change input http://ab.org/old.jpg to 
http://ab.org/<a href=old.jpg>old.jpg</a>
Change input d710823a.jpg to  
<a href=d710823a.jpg>d710823a.jpg</a> 
If input http://j6.com/ no link, because 
no file name. 
If input http://j6.com/a.bcd no link, because 
bcd is not defined. 

<a name=a60207e>
Above "Box 25,output" has one input Box 
,file name char.
This long string has following groups 
Lowercase alphabet abcdefghijklmnopqrstuvwxyz
Digits    0123456789
Other symbol _.#/:

<a name=a60207f>
Domain name, sub-directory name, file name use 
Lowercase, Uppercase, Digits and '_'. 
Domain name freeman2.com extension need '.' 
File name myjpg001.jpg extension need '.' 
In page stop points utility5.htm#box24 need '#' 
"http://" need ':' and '/'. User can control 
these symbols. For example, if delete  ':', '/'
in 'http://ab.com/old.jpg' start from jpg go
left find legal symbol stop at '/' (undefined)
then link apply to 'old.jpg' only. 
Another example, if add '?' add '=' to 
file name char. definition box, then URL
will be linked.
Liu,Hsinhan do not know which characters are 
legal in URL name. Build definition box, let 
user input legal URL name bytes.
2017-02-07-11-18 here

<a name=a60207g>
main function addlink_evenIfRepeat(arg1,arg2,arg3)
nearly add link to all URL. If input 
<a href='http://f2.com/e.htm'>http://f2.com/e.htm</a>
main function output next
<a href='<a href=http://f2.com/e.htm>http://f2.com/e.htm</a>'><a href=http://f2.com/e.htm>http://f2.com/e.htm</a></a>
Link second time? clearly error. In this case 
aux. function addlink_noRepeat(arg1,arg2,arg3)
Assume input has next four lines 
http://f2.com/ & http://h4.net/ 
Please view image <a href=http://g3.com/h6.jpg>
http://g3.com/h6.jpg</a> Please forward to others 
http://i5.net/ & http://j6.com/a.bcd 

<a name=a60207h>
aux. function addlink_noRepeat() divide input 
in three sections 
aux. function send section one 
http://f2.com/ & http://h4.net/ 
Please view image 
to function addlink_evenIfRepeat() to add link.

aux. function keep section two 
<a href=http://g3.com/h6.jpg>
NOT send to function addlink_evenIfRepeat() 
aux. function addlink_noRepeat() copy section two 
to output string. Just copy and not add link the
reason is section two is already linked, cannot 
link again. 

aux. function send section three 
 Please forward to others 
http://i5.net/ & http://j6.com/a.bcd 
to function addlink_evenIfRepeat() to add link.

<a name=a60207i>
main function addlink_evenIfRepeat() process 
input string line by line. Above section two 
string has one linked URL in two lines. 
main function is unable to see earlier line 
and unable to see future line. This is why 
main function produce second time link. 

aux. function addlink_noRepeat() do not process 
input string line by line.
aux. function not use inpUL=inp0.split('\n');
aux. function process input by blocks. 
Use aux. function work with main function get 
correct output. 

<a name=a60207j>
Liu,Hsinhan test add link program. Choose long 
input. Copy screen from 
Paste to Box 24, click  find 98% output 
no link !! The reason is LiuHH page has many 
"<a" like "<a name=a60207j>". 
Program see "<a" assume it is "<a href=..." 
and stop link. To solve this problem, exam 
input text, if not see "<a href=..." then 
click , not click .
 call main function directly.
 call aux. function and select text, 
either call main function or just copy and 
not add link. 

<a name=a60326a> 
Update 2017-03-26 add One equation apply to number sequence
prime pair  5,  7; 11, 13; 17, 19; 29, 31; 41, 43... gap=2
prime pair  7, 11; 13, 17; 19, 23; 37, 41; 43, 47... gap=4
prime pair 23, 29; 31, 37; 47, 53; 53, 59; 61, 67... gap=6
prime pair 89, 97;359,367;389,397;401,409;449,457... gap=8
prime pair139,149;181,191;241,251;283,293;337,347... gap=10
gap 2 mid seq.  6, 12, 18, 30, 42...,/6  1,  2,  3,  5,  7...
gap 4 mid seq.  9, 15, 21, 39, 45...,/3  3,  5,  7, 13, 15...
gap 6 mid seq. 26, 34, 50, 56, 64...,/2 13, 17, 25, 28, 32...
gap 8 mid seq. 93,363,393,405,453...,/3 31,121,131,135,151...
gap10 mid seq.144,186,246,288,342...,/6 24, 31, 41, 48, 57...
What characteristic can be found in these 
prime pair middle sequence ? Please think. 

<a name=a60722a> 
Update 2017-07-23 added Test javascript functions 
program. On 2017-07-21-10-44 upload 
Numeric Javascript numeric-1.2.6.js document 
to http://freeman2.com/numjsdoc.htm
On 2017-07-21-15-53 test run 
A = [[1,2,5],[3,5,-1],[7,-3,5]];
B = numeric.eig(A);
C = B.E.dot(numeric.T.diag(B.lambda)).dot(B.E.inv());
<a name=a60722b> 
numeric-1.2.6.js document say the output is 
But numjsdoc.htm get 
'-1' become '+1' that is big error. 
<a name=a60722c> 
After debug, find bye09() has error. 
error code is if(nine0<0)nine0--; 
right code is if(in09<0)nine0--; //a607211645

Liu,Hsinhan build utility to test javascript 
functions. Now upload let everyone use it. 


<a name=box27>
Following function is useful for Liu,Hsinhan's limited requirement.
Liu,Hsinhan use this code to build Chinese http://freeman2.com/a/biogm001.htm
replace string :click RUN ,output to Box 28
, , from , to ,
Fill input string to Box 27, code output string
Click [Ex.27] and click [RUN rename] see output at Box 28
Box 27,input ;

Box 28,output ;

QBboxa28.value='' ;

Javascript index
http://freeman2.com/jsindex2.htm   local
Save graph code to same folder as htm files.
http://freeman2.com/jsgraph2.js   local

file name utility4.htm mean
utility program, 4 th .htm
Chinese version is utility3.htm (future upload)
utility1.htm and utility2.htm are Liu,Hsinhan off line utility.
utility3.htm and utility4.htm are on line utility.

2015-01-12-14-53 save as cps10401.htm (copy screen 104 year 01 month)
2015-01-15-20-51 copy cps10401.htm utility4.htm
cps10401.htm is for LiuHH brother need. After done, upload same function
page to internet, let every one have chance to access.

The address of this file is
First upload 2015-01-18

Thank you for visiting Freeman's page.
Freeman Liu,Hsinhan 劉鑫漢