ÿþ<HTML> <HEAD> <TITLE>Abel s Summation by Parts</TITLE> <META http-equiv=Content-Type content="text/html"> <style type="text/css"> v\:* { behavior: url(#default#VML); } </style> <!-- The Cauchy-Schwarz Master Class author --> <meta name="author" content="J. Michael Steele" /> <!-- XYGraph v2.3 code author --> <meta name="author" content="J. Gebelein" /> <!--sumpart2.htm author --> <meta name="author" content="Liu, HsinHan ‰Rk”"o &#21129;&#37995;&#28450;" /> <script type="text/javascript"> <!-- //2009-08-23-11-48 //If one function defined twice in a html file //MSIE accept the last definition, //MSIE ignore older definition //Netscape accept the first definition //Netscape ignore newer definition //LiuHH's file structure use MSIE method. //Netscape method not compatible with LiuHH's //file structure. //LiuHH's file structure define one function //twice on purpose. //LiuHH do not know what code to select browser //If user use Netscape to view this page, some //function can never work. For example gamma() //2009-08-23-11-56 // // //If can not load jsgraph2.js next definition is //effective, tell user where to get jsgraph2.js var msg01='document.getElementById("gotoFM2msg").innerHTML+=\''; var msg02=' goto online to get http://freeman2.com/jsgraph2.js<br>\';'; function stepf(t0,bgn0) //9712091955 {eval(msg01+'01'+msg02);} function loggamma(x) {eval(msg01+'02'+msg02);} function gamma(x) {eval(msg01+'03'+msg02);} function factorial(n) {eval(msg01+'04'+msg02);} function wipeCurve(d3) {eval(msg01+'05'+msg02);} function DrawGraf2(argd2) {eval(msg01+'06'+msg02);} function closeStr(klozID) {eval(msg01+'07'+msg02);} function toSyntax(inStr1) {eval(msg01+'08'+msg02);} function x2t(in0) {eval(msg01+'09'+msg02);} function deleteData(workID,probID) {eval(msg01+'10'+msg02);} function delAll(probID) {eval(msg01+'11'+msg02);} function openTable(drawID,table01) {eval(msg01+'12'+msg02);} function open0lxr(xx) {eval(msg01+'13'+msg02);} function closelxr(yy) {eval(msg01+'14'+msg02);} //9712092032 //if receive http://freeman2.com/jsgraph2.js // jsgraph2.js redefine above functions, //otherwise tell where to find jsgraph2.js function XYGraph(yy) {eval(msg01+'101'+msg02);} //9801260855 function XYLine(yy) {eval(msg01+'102'+msg02);} //9801260857 function Label(yy) {eval(msg01+'103'+msg02);} //9801260859 //function tutelink() //9806231220 function tuteLink() //9811151029 change to 'Link' { document.getElementById("gotoFM2msg").innerHTML+= '50 goto online to get http://freeman2.com/tutelink.js<br>'; } function initial0(linkNum, plotNum) { tuteLink(0); //9806231221 //http://freeman2.com/tutelink.js //if use tutelink(0) when offline, get error 9711252125 } function alert0() //9806161720 { document.write('<font color=red>' +'This file is personal home work. No one <br>' +'proofread. Cannot promise correctness. <br>' +'If you suspect any view point wrong, <br>' +'please ask a math expert near by. <br>' +'Freeman 2009-06-19-10-46</font><br>' ); } //9806161724 function ineqIndexEn() //9806170948 { document.write('' +'<a name="index">&lt;a name="index"&gt;</a><a name="index01"></a><br>' +'<font color=red size=+3>Can not load index file</font><br>' +'Please download ineqinde.js Save to same folder as this file.<a href=http://freeman2.com/ineqinde.js><br>' +'http://freeman2.com/ineqinde.js</a><br>' ); } //9806170952 //If receive ineqinde.js //re-define function ineqIndexEn() //print index correctly. function alert1() //9806261745 { document.write('' +'<br><font color=red size=+3>' +'Following is exercise hint and solution. <br>' +'Suggest reader solve problem first, then <br>' +'use your solution compare with LiuHH&#39;s <br>' +'solution. LiuHH&#39;s sol. has no guarantee. <br>' +'Your solution could be better and correct. <br>' +'2009-07-28-10-16<br>' +'</font><br>\n<br>\n<br>\n' ); } //function alert1() 9806261748 function alert2() //9806261808 { document.write('' +'0<font color=red size=+3>' +'LiuHH&#39;s sol. has no guarantee!</font>' ); } //function alert2() 9806261809 function alert3() //9810281727 { document.write('' +'<font color=red><br>' +'Questionable words or incorrect words <br>' +'change to silver color. 2009-10-28-13-50<br>' +'</font>' ); } //function alert3() 9810281729 /** <script language="javascript">alert0()</script> <script language="javascript">alert3()</script> /**/ function alert4() //9812060000 { document.write('<font color=red>' +'Output may contain error, Please verify first. <br>' +'Program environment is MSIE 6.0, please use MSIE<br>' +'</font>' ); } //function alert4() 9812060002 //9907251140 var link0='Sum_by_parts ' +'<a href=#docA014>equation</a> ' +'derive <a href=tute0049.htm#ch14a053>1</a> <a href=tute0049.htm#ch14a229>2</a> <a href=tute0049.htm#ch14a235>3</a>; ' +'<a href=#docA001>docA</a>; ' +'<a href=#docA027>4 ref.</a>; <br>' +'<a href=#docA021>build</a>; ' +'<a href=#ControlCenter>input</a>; ' +'<a href=#boxb11Here>click</a>; ' +'<a href=#buildSequence>box5</a>; ' +'<a href=#buildSequence>Prob.14.2</a>; ' +'<a href=#sortnumb>sort</a>; ' +'<a href=#docB001>help1</a>; ' //9907251150 //--> </SCRIPT> <script src="http://freeman2.com/tutelink.js" language="javascript"></script><!--9806111210--> <script src="tutelink.js" language="javascript"></script><!--9806111211--> <script type="text/javascript" src=jsgraph2.js> </script><!--9808261915--> <script type="text/javascript" src=mathinc2.js> </script><!--9901312256--> <script type="text/javascript" src=complex2.js> </script><!--9901312332--> <script type="text/javascript" src=drawcod2.js> </script><!--9902011133--> <script lang="javascript"> <!-- //9901072310 include isAlpha(ch) to tute0026.htm function isAlpha(ch) //9809151101 { if((ch>='a'&&ch<='z') ||(ch>='A'&&ch<='Z') ) return true; return false; } //--> </script> </HEAD> <body link="#FF0000" vlink="#0000FF" alink="#50A000" bgcolor="#ccfcfc" onload="javascript:initial0()" > <span id="gotoFM2msg"></span><!--9712091951--> <font size=+1> <a href="#AbelSumByParts"> Abel s </a> Summation <a href="#ControlCenter"> by Parts </a> </font> &nbsp; <a href="#docB050"> Update 2010-08-05 </a> <br> <a href=http://www.structura.info/XYGraph/XYGraphDemo.htm> XYGraph v2.3 - web page graph </a> &nbsp; <!--9506231219 add link--> <a href=http://www.structura.info/XYGraph/Links.htm> && <!--##9756;##9758;--> </a> &nbsp; <!--9506231216 add link--> <a href=http://www.structura.info/XYGraph/Purchase.htm> donate<!--9801031950 use donate ##9829;##9835; e&k&--> </a> &nbsp; <a href="http://www.structura.info/XYGraph/XYGraph.zip"> get code</a> <!-- 2006-06-12-18-21 download http://www.structura.info/XYGraph/XYGraph.zip C:\$fm\js\xygraph\XYGraph.zip 2006-06-19-08-21 record --> <br> <a href=http://www-stat.wharton.upenn.edu/~steele/Publications/Books/CSMC/CSMC_index.html> The Cauchy-Schwarz Master Class </a> &nbsp; <a href=http://www-stat.wharton.upenn.edu/~steele/index.html> J. Michael</a> <a href=http://www.wharton.upenn.edu/faculty/steele.html> Steele</a> &nbsp; <a href=http://www.amazon.com/review/product/052154677X/ref=cm_cr_dp_all_helpful?%5Fencoding=UTF8&coliid=&showViewpoints=1&colid=&sortBy=bySubmissionDateDescending> &&&&& </a><!--9806081839 add link--> <br> <font color=red> This file is personal home work. No one <br> proofread. Cannot promise correctness. <br> If you suspect any view point wrong, <br> please ask a math expert near by. <br> Freeman 2009-06-19-10-46</font> <br> Please use MSIE browser to read this file. <br> Did not test other browser. This file is <br> <!--9806081846--> written under MSIE 6.0 <br> <span id="tuteLink1"></span> <br> <script src="http://freeman2.com/rocsitee.js" language="javascript"></script> <br> <pre><font size=+2><a name="AbelSumByParts"></a><a name="docA001">&lt;a name="docA001"&gt;</a> <a href=#docA014>eqn.BQ072</a> </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <pre><font size=+2>2010-07-19-17-20 start <a href="#ControlCenter">ControlCenter</a> Abel s Summation by Parts main reference is next two web pages 2010-04-25-15-24 LiuHH access<a href=http://www.math.uconn.edu/~kconrad/math121/121sumbypartsproj.pdf> http://www.math.uconn.edu/~kconrad/math121/121sumbypartsproj.pdf</a> 2010-04-25-16-04 LiuHH access<a href=http://fractal.math.unr.edu/~ejolson/311-06/handout/sumpart.pdf> http://fractal.math.unr.edu/~ejolson/311-06/handout/sumpart.pdf</a> <a name="docA002">&lt;a name="docA002"&gt;</a> The derivation is at (<a href=tute0049.htm#ch14a037>local</a>)<a href=http://freeman2.com/tute0049.htm#ch14a037> tute0049.htm#ch14a037</a> Conclusion has three equations <a href=tute0049.htm#ch14a069>eqn.BQ070</a> boundary=sum+sum <a href=tute0049.htm#ch14a070>eqn.BQ071</a> boundary+0=sum+sum <a href=#ch14a073>eqn.BQ072</a> sum=boundary-sum They are all equivalent. <a name="docA003">&lt;a name="docA003"&gt;</a> This page<a href=http://freeman2.com/sumpart2.htm> http://freeman2.com/sumpart2.htm</a> output in eqn.BQ072 form at <a href="#boxb13Here">Box 3, output</a> <a name="ch14a053"></a><a name="docA004">&lt;a name="docA004"&gt;</a> Next is Abel s Summation by Parts Formula Given two real number sequences each have total n elements. a.seq: a<sub>1</sub>,a<sub>2</sub>,...,a<sub>n</sub> and b.seq: b<sub>1</sub>,b<sub>2</sub>,...,b<sub>n</sub> <a name="ch14a054"></a><a name="docA005">&lt;a name="docA005"&gt;</a> Define uppercase A and B as the partial sum of a.seq and b.seq A<sub>k</sub>="[i=1,k]a<sub>i</sub> ---eqn.BQ043 B<sub>k</sub>="[i=1,k]b<sub>i</sub> ---eqn.BQ044 where 1f"kf"n. Define A<sub>0</sub>=0 ---eqn.BQ045 B<sub>0</sub>=0 ---eqn.BQ046 Repeat eqn.BQ072 below.</font></pre> <a name="ch14a073"></a><a name="docA006">&lt;a name="docA006"&gt;</a> <font color=red><b> Abel s Summation by Parts formula </b></font> <TABLE WIDTH="460" id=T905Liua border=0 ><!--9907182135--> <TR> <TD> <TABLE WIDTH="420" border=0 id=T905Liub > <TR> <TD> <CENTER><FONT SIZE=-1>k=n</FONT></CENTER> <CENTER><FONT SIZE=+3>"</FONT></CENTER> <CENTER><FONT SIZE=-1>k=m</FONT></CENTER> </TD> <TD> A<sub>k</sub>*b<sub>k</sub> </TD> <TD> &nbsp; = &nbsp; </TD> <TD> A<sub>n</sub>*B<sub>n</sub> ÿA<sub>m-1</sub>*B<sub>m-1</sub> </TD> <TD> ÿ </TD> <TD> <CENTER><FONT SIZE=-1>k=n</FONT></CENTER> <CENTER><FONT SIZE=+3>"</FONT></CENTER> <CENTER><FONT SIZE=-1>k=m</FONT></CENTER> </TD> <TD> a<sub>k</sub>*B<sub>k-1</sub> </TD> </TR> </TABLE> <TABLE WIDTH="520" border=0 id=T905Liuc > <TR> <TD> <CENTER><FONT SIZE=-1>x=b</FONT></CENTER> <CENTER><FONT SIZE=+3>+"</FONT></CENTER> <CENTER><FONT SIZE=-1>x=a</FONT></CENTER> </TD> <TD> F(x)*g(x)*dx </TD> <TD> = </TD> <TD> F(b)*G(b) ÿF(a)*G(a) </TD> <TD> ÿ </TD> <TD> <CENTER><FONT SIZE=-1>x=b</FONT></CENTER> <CENTER><FONT SIZE=+3>+"</FONT></CENTER> <CENTER><FONT SIZE=-1>x=a</FONT></CENTER> </TD> <TD> f(x)*G(x)*dx </TD> </TR> </TABLE> </TD> </TR> </TABLE> ---Summation by parts eqn.BQ072 <br> ---Integration by parts eqn.BQ073 <br> width of above equation <INPUT name=Button905Liua type="button" value="default" onclick="B905Liua.value=460, B905Liub.value=420, T905Liua.width=B905Liua.value, T905Liub.width=B905Liub.value T905Liuc.width=1.25*B905Liub.value "> <input id=B905Liua value=460 size=3 onchange=T905Liua.width=B905Liua.value /> <input id=B905Liub value=420 size=3 onchange=" T905Liub.width=B905Liub.value T905Liuc.width=1.25*B905Liub.value " /> <pre><font size=+2>2010-07-19-17-50 stop </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <pre><font size=+2><a name="docA007">&lt;a name="docA007"&gt;</a> 2010-07-25-09-38 start <a href="#docA006">eqn.BQ072</a> is first version of Abel s Summation by Parts formula. It is a reading of math.unr.edu paper. Next LiuHH try to use above equation to solve math.uconn.edu <a href="tute0049.htm#ch14a224">exercise 4</a>, but do not know how. <a name="docA008">&lt;a name="docA008"&gt;</a> Exercise 4 ask for finding formula for "[k=1,n]k*2<sup>k</sup>. It is sum of product of k and 2<sup>k</sup>. eqn.BQ072 is an expression of sum of product of partial sum A<sub>k</sub> and element b<sub>k</sub>. <a name="docA009">&lt;a name="docA009"&gt;</a> How to convert sum of partial sum to sum of no_more_sum ? math.uconn.edu use a equation similar to the following version 3 equation. math.uconn.edu did not derive the equation. LiuHH continue search online paper. <a name="docA010">&lt;a name="docA010"&gt;</a> 2010-07-24 LiuHH found a paper from math.ust.hk/excalibur/ which is Abel s Summation by Parts formula version 2 below. After read and try solve Exercise 4, <a name="docA011">&lt;a name="docA011"&gt;</a> there is still trouble. Version 2 is sum of no_more_sum = boundary - sum of partial_sum Here sum of partial_sum is same trouble. <a name="docA012">&lt;a name="docA012"&gt;</a> Continue read online paper find math.uic.edu/~leon/ has sum by parts version 3 (same as math.uconn.edu) Still no derivation, but Exercise 4 is an example at uic.edu page. LiuHH try figure out the derivation of version 3. <a name="docA013">&lt;a name="docA013"&gt;</a> Above work all present in study notes page <a href=http://freeman2.com/tute0049.htm>tute0049.htm</a> Next list three versions side by side for easy comparison. 2010-07-25-10-06 here </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <br><br> <a name="docA014">&lt;a name="docA014"&gt;</a> <font color=red><b> Abel s Summation by Parts formula </b></font> <TABLE WIDTH="560" id=T981Liua border=0 ><!--9907251008--> <TR> <TD> <TABLE WIDTH="420" border=0 id=T981Liub > <TR> <TD> <CENTER><FONT SIZE=-1>k=n</FONT></CENTER> <CENTER><FONT SIZE=+3>"</FONT></CENTER> <CENTER><FONT SIZE=-1>k=m</FONT></CENTER> </TD> <TD> A<sub>k</sub>*b<sub>k</sub> </TD> <TD> &nbsp; = &nbsp; </TD> <TD> A<sub>n</sub>*B<sub>n</sub> ÿA<sub>m-1</sub>*B<sub>m-1</sub> </TD> <TD> ÿ </TD> <TD> <CENTER><FONT SIZE=-1>k=n</FONT></CENTER> <CENTER><FONT SIZE=+3>"</FONT></CENTER> <CENTER><FONT SIZE=-1>k=m</FONT></CENTER> </TD> <TD> a<sub>k</sub>*B<sub>k-1</sub> </TD> </TR> </TABLE> <TABLE WIDTH="480" border=0 id=T910Liud > <TR> <TD> <font color=red><b> <CENTER><FONT SIZE=-1>k=n</FONT></CENTER> <CENTER><FONT SIZE=+3>"</FONT></CENTER> <CENTER><FONT SIZE=-1>k=m</FONT></CENTER> </b></font> </TD> <TD> <font color=red><b> a<sub>k</sub>*b<sub>k</sub> </b></font> </TD> <TD> <font color=red><b> = </b></font> </TD> <TD> <font color=red><b> A<sub>n</sub>*b<sub>n</sub> ÿA<sub>m-1</sub>*b<sub>m</sub> </b></font> </TD> <TD> <font color=red><b> ÿ </b></font> </TD> <TD> <font color=red><b> <CENTER><FONT SIZE=-1>k=n ÿ1</FONT></CENTER> <CENTER><FONT SIZE=+3>"</FONT></CENTER> <CENTER><FONT SIZE=-1>k=m</FONT></CENTER> </b></font> </TD> <TD> <font color=red><b> A<sub>k</sub>*(b<sub>k+1</sub> ÿb<sub>k</sub>) </b></font> </TD> </TR> </TABLE> <TABLE WIDTH="540" border=0 id=T911Liud > <TR> <TD> <font color=blue><b> <CENTER><FONT SIZE=-1>k=n</FONT></CENTER> <CENTER><FONT SIZE=+3>"</FONT></CENTER> <CENTER><FONT SIZE=-1>k=m</FONT></CENTER> </b></font> </TD> <TD> <font color=blue><b> a<sub>k</sub>*(b<sub>k</sub> ÿb<sub>k-1</sub>) </b></font> </TD> <TD> <font color=blue><b> = </b></font> </TD> <TD> <font color=blue><b> +a<sub>n</sub>*b<sub>n</sub> ÿa<sub>m-1</sub>*b<sub>m-1</sub> </b></font> </TD> <TD> <font color=blue><b> ÿ </b></font> </TD> <TD> <font color=blue><b> <CENTER><FONT SIZE=-1>k=n</FONT></CENTER> <CENTER><FONT SIZE=+3>"</FONT></CENTER> <CENTER><FONT SIZE=-1>k=m</FONT></CENTER> </b></font> </TD> <TD> <font color=blue><b> (a<sub>k</sub> ÿa<sub>k-1</sub>)*b<sub>k-1</sub> </b></font> </TD> </TR> </TABLE> </TD> </TR> </TABLE> ---Summation by parts ---eqn.BQ072 (<a href=tute0049.htm#ch14a053>ver.1</a>) <br> ---<font color=red><b>eqn.BQ373</b></font> (<a href=tute0049.htm#ch14a229>ver.2</a>) ---<font color=blue><b>eqn.BQ375</b></font> (<a href=tute0049.htm#ch14a235>ver.3</a>) <br> click ver.1 ver.2 ver.3 for formula derivation. <br> width of above equation <INPUT name=Button981Liua type="button" value="default" onclick="B981Liua.value=460, B981Liub.value=420, T981Liua.width=B981Liua.value, T981Liub.width=B981Liub.value T981Liuc.width=1.25*B981Liub.value "> <input id=B981Liua value=460 size=3 onchange=T981Liua.width=B981Liua.value /> <input id=B981Liub value=420 size=3 onchange=" T981Liub.width=B981Liub.value T981Liuc.width=1.25*B981Liub.value " /> <pre><font size=+2><a name="docA015">&lt;a name="docA015"&gt;</a> 2010-07-25-10-25 here Version one (black) has a click button [Sum by parts V1] Version two (red) has a click button [Sum by parts V2] Version three (blue) do not code and no click button. Version two solve Exercise 4 so LiuHH did not code for ver. 3 <a name="docA016">&lt;a name="docA016"&gt;</a> Next is one example how to use the control panel to build a problem. If you click [21] button, program fill data to box 1 box 2 directly. It is next problem "[k=1,5]k*2^k = (5-1)*2^(5+1)+2 = 258 <a name="docA017">&lt;a name="docA017"&gt;</a> If click [Sum by parts V2] button box 3 output next [[ Sum by parts V2 output Two numbers must be the same Sum akbk:258 SumThree:258 SumThree=sum of 3 numbers Anbn:480 +Ambm:0 +Sum Akbk:-222 Uppercase A,B are partial sum lowercase a,b are input seq. Ambm is A[m-1]*B[m-1] variable name akBk drop '-1' calculation use a[k]*B[k-1] 9907250002 ]] <a name="docA018">&lt;a name="docA018"&gt;</a> where Sum akbk:258 is red eqn left side sum akbk:258 is answer. </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <pre><font size=+2><a name="docA019">&lt;a name="docA019"&gt;</a> SumThree:258 is red eqn right side sum Anbn:480 is red eqn right side A<sub>n</sub>*b<sub>n</sub> <a name="docA020">&lt;a name="docA020"&gt;</a> +Ambm:0 is red eqn right side -A<sub>m-1</sub>*b<sub>m</sub> +Sum Akbk:-222 is red eqn right side -A<sub>k</sub>*(b<sub>k+1</sub>-b<sub>k</sub>) <a name="docA021">&lt;a name="docA021"&gt;</a> If you want to build other number sequence. Do the following Still take "[k=1,5]k*2^k as example. Instead of 5, now try "[k=1,20]k*2^k We need two sequence k and 2^k Build 1,2,3,4, ... , 20 as next <a name="docA022">&lt;a name="docA022"&gt;</a> In Box 5 fill in equation x program use x as independent variable, you can not fill k Next fill in three numbers x bgn 1 ; x step 1 ; x end 20 Make sure Output to box 1 is checked. Then click [Build Seq] Box 1 receive data sequence. <a name="docA023">&lt;a name="docA023"&gt;</a> Next In Box 5 fill in equation pow(2,x) Javascript use pow(2,x) for 2^x Next fill in three numbers x bgn 1 ; x step 1 ; x end 20 Make sure Output to box 2 is checked. Then click [Build Seq] Box 2 receive data sequence. <a name="docA024">&lt;a name="docA024"&gt;</a> Now it is OK to click [Sum by parts V2] button (do not click V1) Box 3 output Sum akbk:39845890 </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <pre><font size=+2><a name="docA025">&lt;a name="docA025"&gt;</a> <a href=tute0049.htm#ch14a243>Close form formula</a> for "[k=1,n]k*2<sup>n</sup> is (n-1)*2<sup>n+1</sup>+2 Javascript code is n=20 (n-1)*pow(2,n+1)+2 <a name="docA026">&lt;a name="docA026"&gt;</a> <a href=complex2.htm#calculator>complex2.htm#calculator</a> give answer (n-1)*pow(2,n+1)+2 39845890 <a name="docA027">&lt;a name="docA027"&gt;</a> Four reference web pages, LiuHH access date and URL are 2010-04-25-15-24 <a href=http://www.math.uconn.edu/~kconrad/math121/121sumbypartsproj.pdf> http://www.math.uconn.edu/~kconrad/math121/121sumbypartsproj.pdf</a> 2010-04-25-15-27 <a href=http://www.math.ust.hk/excalibur/v11_n3.pdf> http://www.math.ust.hk/excalibur/v11_n3.pdf</a> 2010-04-25-15-29 <a href=http://www.math.uic.edu/~leon/cs-mcs401-s08/handouts/summation_by_parts.pdf> http://www.math.uic.edu/~leon/cs-mcs401-s08/handouts/summation_by_parts.pdf</a> 2010-04-25-16-04 <a href=http://fractal.math.unr.edu/~ejolson/311-06/handout/sumpart.pdf> http://fractal.math.unr.edu/~ejolson/311-06/handout/sumpart.pdf</a> 2010-07-25-11-15 stop </font></pre> <a name="ControlCenter"></a> Abel s Summation by Parts Control Center <a href=#buildSequence>build</a> <a href=#boxb11Here>click</a> <br> <font color=red size=+1> Output may contain error, Please verify first. <br> Program environment is MSIE 6.0, please use MSIE </font> <br> [10^] box is random number upper bound &nbsp; <INPUT id="QGchkbxComplex" type="checkbox" ><a href="#docB006">complex</a><!--9902240753 add for testing--> <br> <table border=1> <tr> <td> <a href="#docB005">10^</a><!--9903131135 add link--> <INPUT value="1.2345" id=QGboxcA4 size=5 > ; <!-- 2009-10-12-20-00 paid attention that Exercise 2.13 limit to complex number real part be positive. Next check box control complex number real part. complex number imaginary part is +/0/- user can not control. 2009-10-12-20-12 --> <INPUT id="QGchkbxcA2" type="checkbox" onclick="QGchkbxcA3.checked=!QGchkbxcA2.checked;" checked >+/0 , <INPUT id="QGchkbxcA3" type="checkbox" onclick="QGchkbxcA2.checked=!QGchkbxcA3.checked;" >+/0/- ; <INPUT value="5" id=QGboxcA3 size=5 > digits; <input type="checkbox" name="QGchkbxcA4" id="QGchkbxcA4" /><a href="#docB008"> eq.p</a><!--9902231534 begin equal probability--> </td> </tr> <tr> <td> fill <INPUT value="20" id=QGboxcA1 size=5 > numbers; <input type="checkbox" name="QGchkbxcA1" id="QGchkbxcA1" /> integer; &nbsp; <a href="#docB010">b=a^</a><!--9903131124 add link--> <INPUT value="non-proportion" id=QGboxbaP size=10 onchange="javascript:var baP0=baProportion(QGboxb11.value,QGboxbaP.value);if(baP0.length>0)QGboxb12.value=baP0" > <!--9903091807--> &nbsp; <a href="#docB001">Help1</a> </td> </tr> <tr> <td> <input type="button" value="Random" onclick="javascript: QGboxb11.value= fillRand5(QGchkbxComplex.checked, QGboxcA4.value, QGboxcA3.value, QGboxcA1.value, QGchkbxcA3.checked, QGchkbxcA1.checked); " /> <!--9907181746--> &nbsp; <!-- next line OK <input type="button" value="random5#" onclick="javascript:QGboxb11.value=fillRand5(0,QGboxcA4.value,QGboxcA3.value,QGboxcA1.value,QGchkbxcA3.checked,QGchkbxcA1.checked)" /> fillRand5() parameters arg1 = 0/1, if 1 output complex, else real arg2 = 10^this, 10^2=random in [0,100] arg3 = precision, 5 output 12.345 arg4 = generate this many random numbers arg5 = 0/1 for +/0 [false] or +/0/- [true] arg6 = 0/1 for real [false] or integer [true] 2010-02-19-11-08 --> <input type="button" value="Random+Random" onclick="javascript: QGboxb11.value= fillRand5(QGchkbxComplex.checked, QGboxcA4.value, QGboxcA3.value, QGboxcA1.value, QGchkbxcA3.checked, QGchkbxcA1.checked); QGboxb12.value= fillRand5(QGchkbxComplex.checked, QGboxcA4.value, QGboxcA3.value, QGboxcA1.value, QGchkbxcA3.checked, QGchkbxcA1.checked); " /> <!-- 9903081333 rA both box11&12 fill with random rB box11 fill with random, box12 fill with probability --> &nbsp; <input type="button" value="Random+Probability" onclick="javascript: QGboxb11.value= fillRand5(QGchkbxComplex.checked, QGboxcA4.value, QGboxcA3.value, QGboxcA1.value, QGchkbxcA3.checked, QGchkbxcA1.checked); QGboxb12.value= probabOne(QGboxcA1.value,QGchkbxcA4.checked); " /> </td> </tr> </table> <a name="boxb11Here"></a> <table border=0> <tr> <td> Box 1, a<sub>k</sub> <INPUT onclick='javascript:window.clipboardData.setData("Text",document.getElementById("QGboxb11").value.toString())' type=button value="copy1"> <INPUT onclick='document.getElementById("QGboxb11").value=""' type=button value="del1"> <!--9907191418 add s1 --> <input type="button" value="s1" onmouseover="title='Sort Box 1 data 321'" onclick="javascript: //9906211429 var inArray=readdata(QGboxb11.value); bubble_1(inArray, inArray.length ) QGboxb11.value='' //9906211430 +(''+inArray).replace(/,/g,'\n') "> <!--9907191421 add s2 --> <input type="button" value="s2" onmouseover="title='Sort Box 1 data 123'" onclick="javascript: //9906211429 var inArray=readdata(QGboxb11.value); bubble_1(inArray, inArray.length ) inArray=(inArray+'').replace(/,/g,'\n') inArray=upsidedown2(inArray); //9907191421 QGboxb11.value=inArray; "> <br> <TEXTAREA id=QGboxb11 name=QGboxb11 rows=6 cols=30 > 2.27 5.92 6.89 3.47 9.41 nonnegative number sequence</TEXTAREA> </td> <td> Box 2, b<sub>k</sub> <INPUT onclick='javascript:window.clipboardData.setData("Text",document.getElementById("QGboxb12").value.toString())' type=button value="copy2"> <INPUT onclick='document.getElementById("QGboxb12").value=""' type=button value="del2"> <!--9907191429 add s3 --> <input type="button" value="s3" onmouseover="title='Sort Box 2 data 321'" onclick="javascript: //9906211429 var inArray=readdata(QGboxb12.value); bubble_1(inArray, inArray.length ) QGboxb12.value='' //9906211430 +(''+inArray).replace(/,/g,'\n') "> <!--9907191430 add s4 --> <input type="button" value="s4" onmouseover="title='Sort Box 2 data 123'" onclick="javascript: //9906211429 var inArray=readdata(QGboxb12.value); bubble_1(inArray, inArray.length ) inArray=(inArray+'').replace(/,/g,'\n') inArray=upsidedown2(inArray); //9907191421 QGboxb12.value=inArray; "> <br> <TEXTAREA id=QGboxb12 name=QGboxb12 rows=6 cols=30 > 0.181 0.103 0.226 0.237 0.253 Comments can not have digits</TEXTAREA> </td> </tr> </table> m: <!--9907191050--> <INPUT value="1" id=QGboxcm size=5 onchange="if(QGboxcm.value<1)QGboxcm.value=1" > n: <INPUT value="20" id=QGboxcn size=5 onchange=" var nv=parseInt(QGboxcn.value); var mv=parseInt(QGboxcm.value); if(nv<mv) { if(mv<1)nv=1 else QGboxcn.value=QGboxcm.value; } "> <!--9907191054--> <!--9907191029--> <input type="button" value="Sum by parts V1" onmouseover="title='See eqn.BQ072'" onclick="javascript: QGboxb13.value= sumByPartV1(QGboxb11.value,QGboxb12.value, QGboxcm.value,QGboxcn.value); QGspan01.innerHTML='Summation by parts output to box 3' +' Debug to box 4.' " /> <!--9907191056--> <!--9907242317--> <input type="button" value="Sum by parts V2" onmouseover="title='See eqn.BQ373'" onclick="javascript: QGboxb13.value= sumByPartV2(QGboxb11.value,QGboxb12.value, QGboxcm.value,QGboxcn.value); QGspan01.innerHTML='Summation by parts output to box 3' +' Debug to box 4.' " /> &nbsp; <input type="button" value="R+R" onmouseover="title='Random to box 1 & 2'" onclick="javascript: QGboxb11.value= fillRand5(QGchkbxComplex.checked, QGboxcA4.value, QGboxcA3.value, QGboxcA1.value, QGchkbxcA3.checked, QGchkbxcA1.checked); QGboxb12.value= fillRand5(QGchkbxComplex.checked, QGboxcA4.value, QGboxcA3.value, QGboxcA1.value, QGchkbxcA3.checked, QGchkbxcA1.checked); QGboxb13.value=''; " /> <input type="button" value="d" onclick="javascript: QGboxb13.value='' QGboxb14.value='' QGspan01.innerHTML='<br>' " /> <!--9907190929--> <input type="button" value="P.S." onmouseover="title='Partial Sum of box 1 data'" onclick="javascript: QGboxb13.value=partialSumf(QGboxb11.value); QGspan01.innerHTML='Box 3 has box 1 partial sum output.' " /> <!--9907181731--> <input type="button" value="D.S." onmouseover="title='Difference of box 1 Seq.'" onclick="javascript: QGboxb13.value=differenceSeqf(QGboxb11.value); QGspan01.innerHTML='Box 3 has box 1 difference_sequence output.' " /> <!--9907241138--> <br> <font color=red><b> <span id=QGspan01> <br> </span> </b></font> <a name="boxb13Here"></a> <table border=0> <tr> <td> Box 3, output <INPUT onclick='javascript:window.clipboardData.setData("Text",document.getElementById("QGboxb13").value.toString())' type=button value="copy3"> <INPUT onclick='document.getElementById("QGboxb13").value=""' type=button value="del3"> <br> <TEXTAREA id=QGboxb13 name=QGboxb13 rows=6 cols=30 > </TEXTAREA> </td> <td> Box 4, debug <INPUT onclick='javascript:window.clipboardData.setData("Text",document.getElementById("QGboxb14").value.toString())' type=button value="copy4"> <INPUT onclick='document.getElementById("QGboxb14").value=""' type=button value="del4"> <br> <TEXTAREA id=QGboxb14 name=QGboxb14 rows=6 cols=30 > box 5 equation evaluate at what points? define non- equal space points at box 4 If you need equal space, define them at x bgn line. </TEXTAREA> </td> </tr> </table> <a name="buildSequence"></a> <font color=red><b> <span id=QGspan02> equation in box 5 generate data sequence, use x as variable. </span> </b></font> <br> <a href="#docB022"> Box 5, </a> <TEXTAREA id=QGboxb15 name=QGboxb15 rows=1 cols=50 > x*x</TEXTAREA> <INPUT onclick='document.getElementById("QGboxb15").value=""' type=button value="d5"> <br> <!--9907191834 ; 9907192229 del -/-/> i: <INPUT value="1" id=QGboxci size=5 onchange="if(QGboxci.value<1)QGboxci.value=1" > j: <INPUT value="5" id=QGboxcj size=5 onchange=" var jv=parseInt(QGboxcj.value); var iv=parseInt(QGboxci.value); if(jv<iv) { if(iv<1)jv=1 else QGboxcj.value=QGboxci.value; } "> <!--9907191836--> x bgn <!--9907192224--> <INPUT value="0" id=QGboxXbgn size=5 > ; x step <!--9907192226--> <INPUT value="1" id=QGboxXstp size=5 onchange="if(Math.abs(QGboxXstp.value)<1.e-8)QGboxXstp.value=1" > ; x end <!--9907192227--> <INPUT value="10" id=QGboxXend size=5 > <INPUT type=button value="dx" onclick="QGboxXbgn.value=QGboxXstp.value=QGboxXend.value='' QGspan02.innerHTML='Delete equal space, fill un-equal step to box 4' "> <INPUT type=button value="dm" onclick="QGspan02.innerHTML='' "> <br> <a href="#docB028"> Output to box 1 </a> <INPUT name="QGradio01" type="radio" checked >, 2 <INPUT name="QGradio01" type="radio">; <!--9907192244--> <input type="button" value="Build Seq." onclick="javascript:buildSeqf() " /> <!--9907192312--> <INPUT type=button value="01" onclick="QGboxXbgn.value='asin(1)'; QGboxXstp.value='PI/10'; QGboxXend.value='acos(-1)'; QGboxb15.value='x'; QGspan02.innerHTML='x bgn,stp,end can be math expression. Uppercase PI defined' "> <!--9907200807--> <INPUT type=button value="02" onclick="QGboxXbgn.value='E'; QGboxXstp.value='E'; QGboxXend.value='exp(1.2*E)'; QGboxb15.value='x'; QGspan02.innerHTML='x bgn,stp,end can be math expression. Uppercase E defined' "> <!--9907200939--> <INPUT type=button value="11" onclick="QGboxXbgn.value='0.5'; QGboxXstp.value='1'; QGboxXend.value='8'; QGspan02.innerHTML='Click [2%"x%"f"|sin(Àx)|] all equal; [2%"x%"?f"?|sin(x)|] all err' "> <!--9907211154--> <INPUT type=button value="21" onclick=" QGboxb11.value='1 2 3 4 5'; QGboxb12.value='2 4 8 16 32'; QGspan02.innerHTML='"[k=1,5]k*2^k = (5-1)*2^(5+1)+2 = 258 ; Click [Sum V2]' "> <!--9907242350--> <br> Above is summation by parts. Next is CSMC Problem 14.2 <br><!--9907211121 add <br> --> <INPUT type=button value="2%"x%"f"|sin(Àx)|" onclick=" if(QGboxXbgn.value=='')QGboxXbgn.value=0.1; if(QGboxXstp.value=='')QGboxXstp.value='sqrt(PI)'; if(QGboxXend.value=='')QGboxXend.value='E*E*PI'; QGboxb13.value=x_lt_sin(); QGspan02.innerHTML='Box3: 2%"x%"f"|sin(Àx)| ; Box4: %"x%"=min{|t-k|: k=integer}' "> <!--9907211008 QGspan02.innerHTML='%"x%"=min{|x-k|: k=integer} CSMC page 210 line 13<br>' +'2%"x%"f"|sin(x)| CSMC page 211 line 14' --> &nbsp; <a href="#docB034"> No À: </a> <INPUT type=button value="2%"x%"?f"?|sin(x)|" onclick=" if(QGboxXbgn.value=='')QGboxXbgn.value=0.1; if(QGboxXstp.value=='')QGboxXstp.value='sqrt(PI)'; if(QGboxXend.value=='')QGboxXend.value='E*E*PI'; QGboxb13.value=x_lt_sin(0); QGspan02.innerHTML='Box3: 2%"x%"?f"?|sin(x)| dropped À cause error in Box 3' "> <!--9907211122--> <br> <!--9907272030--> <INPUT type=button value="exp(ix)" onclick="javascript: buildSeqf(1); QGspan02.innerHTML='Box 1 complex exp(ix), box 2 same for JS code.' "> <!--9907272109--> <!--9907272259--> <INPUT type=button value="exp(iy)" onclick="javascript:expiy(); "> <!--9907291346--> <INPUT type=button value="rand a+ib" onclick="javascript:randaib(); "> <!--9907291420--> <a href="#docB042">h2</a> <!--9907291636--> <!--9908041658--> <INPUT type=button value="h3" onclick="javascript: QGspan02.innerHTML='You clicked [h3], please read Box 3 and Box 4.' QGboxb13.value='' +'button [exp(ix)] read data\n' +'from x bgn, x step, x end \n' +'generate exp(ix) complex.\n' +'|exp(ix)| is one. Output to\n' +'Box 1, complex number only\n' +'Box 2, complex number with\n' +'javascript code. use this \n' +'code at http://freeman2.com/\n' +'tute0050.htm#ch14b015\n' +'and paste whole code to\n' +'complex2.htm#calculator\n' +'box 3 (of complex2.htm)\n\n' +'button [exp(iy)] read data\n' +'from Box 4, need 4 numbers\n' +'b,c,M,N equation is next\n' +'"[k=1,M]exp(i2À(k*k+b*k+c)/N)\n' +'require 0f"MÿN ; Output to\n' +'Box 1 and Box 2\n\n' +'button [rand a+ib] read data\n' +'from 10^#;#+/0,#+/0/-;#digit\n' +' fill # numbers; # integer\n' +'Above [#] is user input data\n' +'Output to Box 1 and Box 2\n' +'button [rand a+ib] generate\n' +'abs(complex number) NOT=1\n\n' +'Three run buttons all create\n' +'output to Box2 for tute0050\n' +'test code to run for many\n' +'kind of complex sequence.\n' +'2010-08-04-17-27 document.' ; QGboxb14.value='' //9908050712 +'[2%"x%"f"|sin(Àx)|] read data\n' +'from x bgn, x step, x end \n' +'x vary from x bgn to x end\n' +'Output to box 1,2,3 and box4\n' +'Box 1 record sin(Àx) value\n' +'Box 2 record 2*%"x%" value.\n' +'If x=i.f (integer.fraction)\n' +'%"x%" use fraction 0.f select\n' +'if 0.f<=0.5, 2*%"x%" answer \n' +'2*0.f Ex.:x=2.3, 2*%"x%"=0.6\n' +'If 0.p>0.5, 2*%"x%" answer \n' +'2*(1-0.f):x=3.8, 2*%"x%"=0.4\n' +'2*%"x%" period=1,amplitude=1\n' +'|sin(Àx)| period=1,ampli.=1\n' +'|sin(Àx)| concave, hi value\n' +'2*%"x%" linear lower value\n' +'2%"x%"f"|sin(Àx)| always true\n\n' +'Button 2%"x%"?f"?|sin(x)| drop\n' +'À, |sin(x)| period is À. Not\n' +'same pace as 2%"x%" inequality\n' +'is not true any more.\n' +'Box 3 output |sin(Àx)|-2%"x%"\n' +'if value is negative, violate\n' +'inequality, mark [***]\n' +'Liu,Hsinhan 2010-08-05-07-36\n' "> &nbsp; CSMC: <a href="tute0049.htm#ch14a137"> p.210,211 </a> <br> Abel s Summation by Parts formula <a href=#docA014>eqn.BQ072</a> <br> Input/output boxes end here. 9907191754 <a href=http://freeman2.com/tute0014.htm#fig2.5>draw</a> <a href=tute0014.htm#fig2.5>complex</a> <br> <SCRIPT language=JavaScript> <!-- //9907291348 function randaib() { var getCplx= fillRand5(1, QGboxcA4.value, QGboxcA3.value, QGboxcA1.value, QGchkbxcA3.checked, QGchkbxcA1.checked); QGboxb11.value=getCplx; var jsCplx='var cp=[];\n'; getCplx=getCplx.split('\n') var k; for(k=0;k<getCplx.length;k++) { //9907291401 if(getCplx[k].length==0)break; //9907291410 jsCplx+='cp['+k+']=\''+getCplx[k]+'\';\n'; } QGboxb12.value=jsCplx; QGspan02.innerHTML='Random complex to Box 1 (complex) and Box 2 (js code).' return; } //9907291412 function randaib() //9907272300 // function expiy(arg1) { var inp0=readdata(QGboxb14.value); if(inp0.length<4 ||inp0[2]<0 ||inp0[2]>=inp0[3] ) { QGspan02.innerHTML='Please input four numbers in Box 4. Please read Box 3.' QGboxb13.value='' +'Please input four numbers in\n' +'Box 4 in the order b,c,M,N\n' +'CSMC page 210, equation 14.7\n' +'"[k=1,M]exp(i2À(k*k+b*k+c)/N)\n' +'require 0f"MÿN\n' +'function expiy() build only\n' +'exp(i*2*PI*[(k*k+b*k+c)/N])\n' return; //9907272312 } var b=inp0[0] var c=inp0[1] var M=inp0[2] var N=inp0[3] var complex0=''; //9907272053 var sin0,cos0; var oup1='' var oup2='var cp=[];\n'; var i,j,k; var quadra0=0; for(k=0;k<M;k++) { //9907272322 quadra0=2*Math.PI*(k*k+b*k+c)/N; //9907272325 cos0=Math.cos(quadra0) sin0=Math.sin(quadra0) complex0=cos0+(sin0<0?'':'+')+sin0+'i'; oup1+=complex0+'\n'; oup2+='cp['+k+']=\''+complex0+'\';\n'; } //9907272327 QGboxb11.value=oup1; QGboxb12.value=oup2; QGspan02.innerHTML='Output to Box 1 (complex) and Box 2 (js code).' return; //9907272328 } //function expiy(arg1) 9907272328 //9907242320 function sumByPartV2(arg1,arg2,arg3,arg4) { var numb1=readdata(arg1); var numb2=readdata(arg2); if(numb1.length!=numb2.length) return 'numb1.length!=numb2.length' +'\n'+numb1.length+'!='+numb2.length; var m=parseInt(arg3) var n=parseInt(arg4)+1; //9907191157 add '+1' if(m>n) return 'm>n, '+m+'>'+n+'\n' +'m is m box value\n' +'n is n box value\n' var psum1=partialSumf(arg1); var psum2=partialSumf(arg2); var L=numb1.length; //9907191045 if(n>L) { if(m>L) return 'm>L, '+m+'>'+L+'\n' +'m is m box value\n' +'L is box 1 count of numbers' ; n=L+1; //9907191117,9907191158 add '+1' } var i,j,k; var numbA=[]; var numbB=[]; var psumA=[]; var psumB=[]; //9907191105 //partial sum [0] is defined to be zero numbA[0]=numbB[0]= //9907191107 psumA[0]=psumB[0]=0; //numb1[] has user input data 1,2,3 //numbA[] store data as 0,1,2,3 //add 0 to match partialSum[0]=0 //9907242324 for(i=1;i<n;i++) { numbA[i]=numb1[i-1] numbB[i]=numb2[i-1] } //9907191109 psumA[1]=numbA[1]; psumB[1]=numbB[1]; for(i=2;i<n;i++) { //build partial sum psumA[i]=bye09(psumA[i-1]+numbA[i]) psumB[i]=bye09(psumB[i-1]+numbB[i]) } //9907191144 if(typeof QGboxb14=='object') { var dbg0='' dbg0+='m='+m+',n+1='+n+'; '; dbg0+='added leading 0\n'; dbg0+='numbA:\n' //9907191101 for(i=0;i<n;i++) dbg0+=numbA[i]+'\n' dbg0+='==V2==\nnumbB:\n' for(i=0;i<n;i++) dbg0+=numbB[i]+'\n' dbg0+='==V2==\npsumA:\n' for(i=0;i<n;i++) dbg0+=psumA[i]+'\n' dbg0+='==V2==\npsumB:\n' for(i=0;i<n;i++) dbg0+=psumB[i]+'\n' //return dbg0; //9907191139 var msgA=''; if(n<=L)msgA='==V2==\nrecord only effective data.' QGboxb14.value=dbg0+msgA; //9907191149 } //if(typeof QGboxb14=='object') var sumakbk=0; //9907191046 var sumAkbk1=0; //9907191123 for(i=m;i<n;i++) { //sumAkbk+=psumA[i]*numbB[i] //sumakBk1+=numbA[i]*psumB[i-1] sumakbk+=numbA[i]*numbB[i] } for(i=m;i<n-1;i++) { //9907242332 add '-1' sumAkbk1+=psumA[i]*(numbB[i+1]-numbB[i]) } sumakbk = bye09(sumakbk); sumAkbk1=-bye09(sumAkbk1); //var AnBn=+psumA[n-1]*psumB[n-1]; //var AmBm=-psumA[m-1]*psumB[m-1]; //var Anbn=+psumA[n]*numbB[n]; var Anbn=+psumA[n-1]*numbB[n-1]; //9907250002 '-1' var Ambm=-psumA[m-1]*numbB[m]; //9907242342 var sum3=Anbn+Ambm+sumAkbk1; sum3=bye09(sum3); return 'Sum by parts V2 output\n' +'Two numbers must be the same\n' +'Sum akbk:'+sumakbk+'\n' +'SumThree:'+sum3+'\n' +'SumThree=sum of 3 numbers\n' +' Anbn:'+Anbn+'\n' +'+Ambm:'+Ambm+'\n' +'+Sum Akbk:'+sumAkbk1+'\n' +'Uppercase A,B are partial sum\n' +'lowercase a,b are input seq.\n' +'Ambm is A[m-1]*B[m-1]\n' +'variable name akBk drop \'-1\'\n' +'calculation use a[k]*B[k-1]\n' +'9907250002' return dbg0; //9907250003 } //function sumByPartV2() //9907241141 function differenceSeqf(arg1) { var inp2=readdata(arg1); var len0=inp2.length; var i; var oup2=''; for(i=1;i<len0;i++) { oup2+=bye09(inp2[i]-inp2[i-1])+'\n'; } return oup2; //9907241147 } //function differenceSeqf(arg1) //9907202303 //CSMC page 211 line 14 // function x_lt_sin(arg1) { //QGboxb14.value=''; //9907211009 use; 9907211009 del var xbgn=eval('with(Math){'+QGboxXbgn.value+'}') var xstp=eval('with(Math){'+QGboxXstp.value+'}') var xend=eval('with(Math){'+QGboxXend.value+'}') if(Math.abs(xstp)<1.e-8)xstp=1; //9907192300 if(isNaN(xbgn)||isNaN(xstp)||isNaN(xend)) { QGspan02.innerHTML='isNaN(xbgn)||isNaN(xstp)||isNaN(xend)' return 'isNaN(xbgn)||isNaN(xstp)||isNaN(xend)' } else { k=parseInt((xend-xbgn)/xstp); if(k<0)k=-k; xseq=[]; for(i=0;i<=k;i++) xseq[i]=xbgn+i*xstp; } //9907192306 var i,j,k; var xceil,xfloor; //9907202311 var xc,xf; var oup1='sin(Àx) value\n'; if(arg1==0)oup1='sin(x) value\n'; //9907211130 if() var oup2='2*%"x%", double box4 * value\n'; var oup3='2*%"x%"f"|sin(Àx)|; ***=violate\n'; if(arg1==0)oup3='2*%"x%"f"|sin(x)|; ***=violate\n'; //9907211126 if() var oup4='ceil,floor,x,xc,xf; *=min\n'; //9907211011 var tiny0=0.5; //9907211023 var o1,o2; for(i=0;i<xseq.length;i++) { //9907202306 x=xseq[i]; //o1=Math.sin(x); //9907211116 add PI o1=Math.sin(Math.PI*x); if(arg1==0)o1=Math.sin(x); //9907211128 if() o1=bye09(o1); oup1+=o1+'\n' xceil=Math.ceil(x); xc=Math.abs(x-xceil); xfloor=Math.floor(x); xf=Math.abs(x-xfloor); o2=2*Math.min(xc,xf); o2=bye09(o2); oup2+=o2+'\n' o1=Math.abs(o1) oup3+=o2+' '+o1 +((o2>o1)?' ***':'') +'\n' //if(arg1==1) 9907211041 del if() //now always output to box 4 oup4+='' //9907211012 +xceil+', '+xfloor+', ' +(x+'').substring(0,5)+',' //+((xc+'')==(o1+'')?'*':' ') //+(Math.abs(xc-o2/2)<=tiny0?'*':' ') +((xc)<=tiny0?'*':' ') +(xc+'').substring(0,5)+',' //+((xf+'')==(o1+'')?'*':' ') //9907211024 del //+(Math.abs(xf-o2/2)<=tiny0?'*':' ') //use tiny0 +((xf)<=tiny0?'*':' ') //9907211031 +(xf+'').substring(0,5)+'\n' } //9907202318 for(i=0;i<xseq.length;i++) QGboxb11.value=oup1; QGboxb12.value=oup2; QGboxb14.value=oup4 //9907211016 return oup3; } //9907202320 function x_lt_sin(arg1) //9907192244 function buildSeqf(arg1) { //9907272042 set arg1==1 for exp(ix) //if arg1==1, run for exp(ix) //if arg1!=1, run for box 5 equation QGspan02.innerHTML=''; var fillBox=1; if(QGradio01[1].checked)fillBox=2; var i,j,k,x; var xseq=[]; var xbgn=eval('with(Math){'+QGboxXbgn.value+'}') var xstp=eval('with(Math){'+QGboxXstp.value+'}') var xend=eval('with(Math){'+QGboxXend.value+'}') if(Math.abs(xstp)<1.e-8)xstp=1; //9907192300 if(isNaN(xbgn)||isNaN(xstp)||isNaN(xend)) { xseq=readdata(QGboxb14.value); QGspan02.innerHTML='read x value from box 4 for un-equal step length.' } else { k=parseInt((xend-xbgn)/xstp); if(k<0)k=-k; xseq=[]; for(i=0;i<=k;i++) xseq[i]=xbgn+i*xstp; } //9907192306 //exp(ix) if(arg1==1) //9907272051 { var complex0=''; //9907272053 var sin0,cos0; var oup1='' var oup2='var cp=[];\n'; for(i=0;i<xseq.length;i++) { //9907272052 x=xseq[i]; cos0=Math.cos(xseq[i]) sin0=Math.sin(xseq[i]) complex0=cos0+(sin0<0?'':'+')+sin0+'i'; //9907272059 oup1+=complex0+'\n'; oup2+='cp['+i+']=\''+complex0+'\';\n'; } //9907272101 QGboxb11.value=oup1; QGboxb12.value=oup2; return; //9907272102 } var eqn0=QGboxb15.value; if(eqn0=='') {QGspan02.innerHTML='box 5 equation can not be empty, at least fill a "x"';return;} var oup0='' for(i=0;i<xseq.length;i++) { x=xseq[i]; oup0+=eval('with(Math){'+eqn0+'}')+'\n' } //9907192311 if(fillBox==1) QGboxb11.value=oup0; else QGboxb12.value=oup0; QGboxb13.value=eqn0+'\n' +'xbgn='+xbgn+'\n' +'xstp='+xstp+'\n' +'xend='+xend; QGboxb14.value=xseq; } //9907192312 done function buildSeqf(arg1) //9907191038 function sumByPartV1(arg1,arg2,arg3,arg4) { var numb1=readdata(arg1); var numb2=readdata(arg2); if(numb1.length!=numb2.length) return 'numb1.length!=numb2.length' +'\n'+numb1.length+'!='+numb2.length; var m=parseInt(arg3) var n=parseInt(arg4)+1; //9907191157 add '+1' if(m>n) return 'm>n, '+m+'>'+n+'\n' +'m is m box value\n' +'n is n box value\n' var psum1=partialSumf(arg1); var psum2=partialSumf(arg2); var L=numb1.length; //9907191045 if(n>L) { if(m>L) return 'm>L, '+m+'>'+L+'\n' +'m is m box value\n' +'L is box 1 count of numbers' ; n=L+1; //9907191117,9907191158 add '+1' } var i,j,k; var numbA=[]; var numbB=[]; var psumA=[]; var psumB=[]; //9907191105 //partial sum [0] is defined to be zero numbA[0]=numbB[0]= //9907191107 psumA[0]=psumB[0]=0; for(i=1;i<n;i++) { numbA[i]=numb1[i-1] numbB[i]=numb2[i-1] } //9907191109 psumA[1]=numbA[1]; psumB[1]=numbB[1]; for(i=2;i<n;i++) { psumA[i]=bye09(psumA[i-1]+numbA[i]) psumB[i]=bye09(psumB[i-1]+numbB[i]) } //9907191144 if(typeof QGboxb14=='object') { var dbg0='' dbg0+='m='+m+',n+1='+n+'; '; dbg0+='added leading 0\n'; dbg0+='numbA:\n' //9907191101 for(i=0;i<n;i++) dbg0+=numbA[i]+'\n' dbg0+='==V1==\nnumbB:\n' for(i=0;i<n;i++) dbg0+=numbB[i]+'\n' dbg0+='==V1==\npsumA:\n' for(i=0;i<n;i++) dbg0+=psumA[i]+'\n' dbg0+='==V1==\npsumB:\n' for(i=0;i<n;i++) dbg0+=psumB[i]+'\n' //return dbg0; //9907191139 var msgA=''; if(n<=L)msgA='==V1==\nrecord only effective data.' QGboxb14.value=dbg0+msgA; //9907191149 } //if(typeof QGboxb14=='object') var sumAkbk=0; //9907191046 var sumakBk1=0; //9907191123 for(i=m;i<n;i++) { sumAkbk+=psumA[i]*numbB[i] sumakBk1+=numbA[i]*psumB[i-1] } sumAkbk = bye09(sumAkbk); sumakBk1=-bye09(sumakBk1); var AnBn=+psumA[n-1]*psumB[n-1]; var AmBm=-psumA[m-1]*psumB[m-1]; var sum3=AnBn+AmBm+sumakBk1; sum3=bye09(sum3); return 'Sum by parts V1 output\n' +'Two numbers must be the same\n' +'Sum Akbk:'+sumAkbk+'\n' +'SumThree:'+sum3+'\n' +'SumThree=sum of 3 numbers\n' +' AnBn:'+AnBn+'\n' +'+AmBm:'+AmBm+'\n' +'+Sum akBk:'+sumakBk1+'\n' +'Uppercase A,B are partial sum\n' +'lowercase a,b are input seq.\n' +'AmBm is A[m-1]*B[m-1]\n' +'variable name akBk drop \'-1\'\n' +'calculation use a[k]*B[k-1]\n' +'9907191155' return dbg0; //9907191102 } //function sumByPartV1() //9907181732 function partialSumf(arg1) { var inp0=readdata(arg1) var i,j,k; var pSum=[]; pSum[0]=inp0[0]; for(i=1;i<inp0.length;i++) pSum[i]=pSum[i-1]+inp0[i]; var oup0=''; for(i=0;i<inp0.length;i++) oup0+=bye09(pSum[i])+'\n'; return oup0; //9907181736 } //function partialSumf(arg1) //9907181740 include bye09() to sumpart2.htm /** 2009-06-12-15-31 start Javascript use float number for calculation. Answer may contain long string of '000000' or '999999', for example 2.00000000000001 -25.999999999999996 On 2009-06-12-11-58 write a function function bye09(in09) //9806121158 To use this function, call as following coef2=bye09(coef2); where coef2 is a number. After call 2.00000000000001 change to 2 -25.999999999999996 change to -26 It is handy, you can use it too. If number is 1.23111111111 there is no change. function bye09(in09) handle output number for better looking. Do not call bye09() during calculation, that is just slow down process. If expect answer to be irrational Do not call bye09(). If expect answer to be integer or short decimal number like 1.2. In these case you can call bye09(). 2009-06-12-15-40 stop 2009-06-17-19-05 bye09() process only one number at a time. If you have a string of several numbers. Do not put number string as input argument bye09() will send string back immediately. This file has sample code at time stamp '9806171858' 2009-06-17-19-09 stop /**/ function bye09(in09) //9806121158 { // in09 is input number, // for example 2.0000000001 // If input is not a number, return here if(isNaN(in09)) return in09; // where is decimal point '.' ? var dotLoc=(in09+'').indexOf('.',0); // no decimal point? integer? return. if(dotLoc==-1) return in09; // change input string to number in09=parseFloat(in09); // if number has '000000' ? var zeroLoc=(in09+'').indexOf('000000',dotLoc); // find '000000' ,cut start '000000' if(zeroLoc>0) //9806121216 return parseFloat((in09+'').substring(0,zeroLoc)); //9806121209 // if number has '999999' ? var nineLoc=(in09+'').indexOf('999999',dotLoc); // find '999999' , cut start '999999' if(nineLoc>0) //9806121223 here { // copy number left to '999999' //but immediately neighbor digit not copy // nineLoc-1 because '999999' need increase // digit by one. //If input is 1.23999999999 copy only 1.2 //not copy 1.23 , because 3 will change to 4. var nine0=(in09+'').substring(0,nineLoc-1); //between '.' and '999999' has other digit. if(nineLoc-dotLoc>1) //9806121220 { //neighbor digit add one, paste to end nine0+=(parseInt((in09+'').charAt(nineLoc-1))+1); } else //between '.' and '999999' no other digit. {// modified number is an integer nine0=parseInt(nine0); //9806121313 if(nine0<0)nine0--; // negative integer minus one else nine0++; //9806121314 positive integer add one } return parseFloat(nine0); //9806121213 return new number } // no '000000' no '999999' return original form return parseFloat(in09); //9806121224 } //function bye09(in09) //2010-07-26-19-18 //bye09a() = bye09() for Array //bye09a() do not do bye09() work //bye09a() read array number and //call bye09() to work. You must //have bye09() in same file // function bye09a(arg1) //9907261918 { if(typeof arg1=='number') return bye09(arg1); //9907261920 if(typeof arg1!='object') return arg1; //9907261921 if(typeof arg1[0]=='object' &&typeof arg1[0][0]=='object' ) return arg1; //9907261922 var i,j,k; var oup0=''; if(typeof arg1[0]=='object' &&typeof arg1[0][0]=='number' ) { for(i=0;i<arg1.length;i++) for(j=0;j<arg1[i].length;j++) arg1[i][j]=bye09(arg1[i][j]); } else if(typeof arg1[0]=='number') { for(i=0;i<arg1.length;i++) arg1[i]=bye09(arg1[i]); } return arg1; } // function bye09a(arg1) //9907261926 //bye09a() Code //care only 1 dimension array //and 2 dimension array. If you //have 3 dimension array, exercise //your javascript coding skill. //2010-07-26-20-25 stop //2009-09-23-15-01 from tute0009.htm //find function readdata(inStr0) // //var w2=[0,0]; to var w2=[0]; 9906181215 // function readdata(inStr0) //9806101151 { //9807270955 read other's no-comment code //very headache, now back to my code, add //more comments. // //if input inStr0 is Not a Number (isNaN=true) //then inStr0 is an array or string of char. if(isNaN(inStr0) //9807161944 //and if inStr0[0] is a Number //(isNaN=false) (!isNaN=true) //inStr0 is a number array, return oroginal form &&!isNaN(inStr0[0])) return inStr0; //if input inStr0 is empty, return oroginal form if(inStr0.length==0)return inStr0; //9806101153 //if input inStr0 is a number, return oroginal form if(!isNaN(inStr0[0]))return inStr0; //9807271000 //up to here input inStr0 is one string of character //below change string of char '1.23 4.56 7.89 ...' //to number array aa[0]=1.23, aa[1]=4.56, aa[2]=7.89 ... //9807271010 here //assume input string is '1.23 4.56 7.89 ...' //oArray[0] store '1.23' this is a string //oArray[1] store '4.56' not a number yet //oArray[2] store '7.89' convert to number later //9807271043 var oArray=''; //9806101158 var w0,w1,numb0; for(w0=0;w0<inStr0.length;w0++) { numb0=''; //skip those char are NOT [0123456789-+.] // [!(...)] means [is not ...] // [!=] means [not equal] 9807271051 // w1=w0; //9802172117 while(!(inStr0.charAt(w1)>='0' &&inStr0.charAt(w1)<='9') &&inStr0.charAt(w1)!='-' &&inStr0.charAt(w1)!='+' &&inStr0.charAt(w1)!='.' &&w1<inStr0.length ) { //index w1 increase only, //no record what read 9807271058 w1++; } //above while() loop stop at reading //either one in the list [0123456789-+.] //then start next while loop. 9807271055 // while((inStr0.charAt(w1)>='0' &&inStr0.charAt(w1)<='9') ||inStr0.charAt(w1)=='-' ||inStr0.charAt(w1)=='+' ||inStr0.charAt(w1)=='.' ||inStr0.charAt(w1)=='e' ||inStr0.charAt(w1)=='E' &&w1<inStr0.length ) //9802171608 { //If it is either one of [0123456789-+.eE] //continue store data into numb0 . 9807271102 numb0+=inStr0.charAt(w1); w1++; } //if all I get is just '.' for example // 'aa.txt' it is not a number, //no need to build output oArray //9807271106 if(numb0.length==1&&numb0.charAt(0)=='.') { w0=w1; //9802172218 //update index w0=w1 continue; //continue to next iteration. } //skip the following building code. //up to this point, numb0 is useful number //build output string oArray //9807271111 w0=w1; //9806101210 update index //string numb0 to output string oArray //add a newline byte '\n' to separate data // 9807271113 oArray+=numb0+'\n'; //9806101159 } // for(w0=0;w0<inStr0.length;w0++) //done for() loop, done output string oArray //use newline byte '\n' to separate numbers. // oArray.split('\n') in oArray cut data at //newline byte '\n' and change string // '1.23\n4.56\n7.89\n...' //to array oArray[0]='1.23', oArray[1]='4.56', //oArray[2]='7.89' ... //no matter input data use ',' or tab or //newline to separate data, here all done //9807271125 oArray=oArray.split('\n'); //9806101643 //string '1' + string '2' = '12' //number 1 + number 2 = 3 //above is string array oArray[0]='1.23', //below is number array w2[0]=1.23 //9807271130 //var w2=[0,0]; 9906181215 change to next var w2=[0]; for(w0=0;w0<oArray.length;w0++) { //9806101704 //parseFloat() convert string number // to number number. w1=parseFloat(oArray[w0]); //no more number? done if(isNaN(w1))break; //9806101714 w2[w0]=w1; //create number array. } return w2; } // function readdata() 9806101214 //from function update0() //9802171511 //generate equality for Holder inequality // function baProportion(arg1,arg2) { //9903091811 var pow0=parseFloat(arg2); var inp0=readdata(arg1); if(isNaN(arg2) //9903091823 ||arg2.length==0 //9903091828 ) { return fillRand5(0,1,5,inp0.length,0,0); } var w0,oup0=''; for(w0=0;w0<inp0.length;w0++) { oup0+=Math.pow(inp0[w0],pow0)+'\n'; } return oup0; } //function baProportion(arg1,arg2) //9903091816 /** //9809261416 //fillRand(ouBoxID) use ".form1." //fillRand2(ouBoxID) delete ".form1." //fillRand3(ouBoxID) delete ".form1." //use chkbxcB1, chkbxcB2 for sorting //fillRand4(ouBoxID) delete ".form1." //output complex number a+i*b 9810121232 //9810121458 use ouBoxID2 //function fillRand4(ouBoxID1,ouBoxID2) //9810121233 //fillRand5(ouBoxID) same as fillRand4 //but isolate code from page elements ID //all page elements ID enter from //function argument list. 9902190914 9902190929 arg1 = 0/1, if 1 output complex, else real arg2 = power index 10^this arg3 = precision output this many digit arg4 = generate this many random numbers arg5 = 0/1 for +/0 [0] or +/0/- [1] arg6 = 0/1 for real [0] or integer [1] all 0/1 '0' is default, '1' must be specified function code nover refer to any html element ID 9902190936 Next is an example of calling method [[ <input type="button" value="random5#" onclick="javascript: QGboxb11.value= fillRand5(0, QGboxcA4.value, QGboxcA3.value, QGboxcA1.value, QGchkbxcA3.checked, QGchkbxcA1.checked); QGboxb12.value= probabOne(QGboxcA1.value); " /> ]] html elements ID all show up at calling line (above example) html elements ID never show up at function code. So that function can be used at other web page. (other web page have different html elements) 2010-02-19-12-13 /**/ function fillRand5(arg1,arg2, arg3,arg4,arg5,arg6) //9902190917 { //arg1=parseInt(arg1); //9902240803 delete //arg2=parseInt(arg2); arg2=parseFloat(arg2); //9902210800 use parseFloat() arg3=parseInt(arg3); arg4=parseInt(arg4); if( /**isNaN(arg1)|| /*9902240801 delete. Now T/F, not 1/0*/ isNaN(arg2) ||isNaN(arg3)||isNaN(arg4) ) //return 'calling parameter 1/2/3/4 need integers.\n' //9902240802 return 'calling parameter 2/3/4 need integers.\n' +arg1+',' +arg2+',' +arg3+',' +arg4+',' +arg5+',' +arg6 ; //9902191004 var powIndex=arg2; //9902190946 var precision0; precision0=arg3; if(arg6==1)precision0=powIndex; //if powIndex=3, stretch random // from [0,1] to [0,1000] powIndex=Math.pow(10,powIndex); var precision1=Math.pow(10,precision0); var randRang=precision1; //if(powIndex)randRang=randRang/powIndex; //9902232247 change to next line if(powIndex)randRang=randRang/parseInt(powIndex); var randPoNe1=1; var randPoNe3=1; var randPN=1; if(arg5)randPN=-1; var dataPerS=arg4; var DecInt=0; if(arg6)DecInt=1; var ouStr1=''; var ouStr2=''; var oneCplx=''; var t0,t1,t2,t3; var dbg0=''; //9902232227 dbg0+='function fillRand5()\narg1 to arg6 are\n' +arg1+',' +arg2+',' +arg3+'\n' +arg4+',' +arg5+',' +arg6+'\n' +'precision1 ='+precision1+', ' +'powIndex='+powIndex+'\n' +'randRang='+randRang+'\n' //control precision. 9902240725 var minus1byteReal=0; var minus1byteImag=0; for(t0=0;t0<dataPerS;t0++) { t1=Math.random()*precision1; t3=Math.random()*precision1; dbg0+='*****\n' +'t0 ='+t0+', ' +'t1a='+t1+'\n' +'precision1='+precision1+'\n' /** 2009-10-12-20-00 paid attention that Exercise 2.13 limit to complex number real part be positive. Next check box control complex number real part. complex number imaginary part is +/0/- user can not control. 2009-10-12-20-12 /**/ //control precision. 9902240730 minus1byteReal=0; minus1byteImag=0; if(randPN<0) { t2=(t1+'').charAt((t1+'').length-1); if(t2%2)randPoNe1=-1 else randPoNe1=+1; } t2=(t3+'').charAt((t3+'').length-1); if(t2%2)randPoNe3=-1 else randPoNe3=+1; if(randPoNe1==-1)minus1byteReal=1 if(randPoNe3==-1)minus1byteImag=1 dbg0+='' +'t1b='+t1+', ' +'randPoNe1='+randPoNe1+'\n' +'t1=Math.floor(t1)*randPoNe1='+(Math.floor(t1)*randPoNe1)+'\n' t1=Math.floor(t1)*randPoNe1; t1=t1/randRang; dbg0+='' +'randRang='+randRang+'\n' +'t1=t1/randRang='+t1+'\n' if(DecInt)t1=parseInt(t1); //else t1=bye09(t1); //9902232256 //minus1byteReal //9902240733 change to next , '+1' space for '.' else t1=(''+t1).substring(0,arg3+1+minus1byteReal) //9902232254 include function bye09() //9902240739 delete function bye09(), because //".substring(0,arg3+1+minus1byteReal)" is better. t3=Math.floor(t3)*randPoNe3; t3=t3/randRang; if(DecInt)t3=parseInt(t3); //else t3=bye09(t3); //9902232257 //minus1byteImag //9902240737 change to next [=][][] else t3=(''+t3).substring(0,arg3+1+minus1byteImag) if(arg1) oneCplx='' +t1 +(t3<0?'':'+') +t3+'i'; else oneCplx='' //9902191008 +t1 if(randPoNe1==1)ouStr1+=' '; ouStr1+=oneCplx+'\n'; } QGboxb13.value=dbg0 +'9902232241 dbg\n' ; //9902232228 return ouStr1; //9902191043 } //9902191108 done fillRand5() //9806101352 function fillRand(ouBoxID) //9809261417 function fillRand2(ouBoxID) //fillRand3(ouBoxID) delete ".form1." //use chkbxcB1, chkbxcB2 for sorting //fillRand4(ouBoxID) delete ".form1." //output complex number a+i*b 9810121232 /** 99,02,23 version add poArg2 99,02,23 version inp0 change to ans0 9811281438 probability sum to one if poArg1 is input box ID name program read input box value, assume a list of probability numbers 0<=pj<=1 j=1,2,...,n. program normalize pj if poArg1 is an integer n, program create n probability numbers 0<=pj<=1 j=1,2,...,n and SUM{pj}=1 9811281442 probabOne() read input numbers from boxb12 boxb13.value=probabOne(boxb12.value) probabOne(5) ask program to generate 5 probability numbers. boxb13.value=probabOne(n) 9902191115 include probabOne() to holder02.htm 9902231541 call probabOne() as following QGboxb12.value= probabOne(QGboxcA1.value,QGchkbxcA4.checked); poArg1 record number of pj elements asked poArg1 can be an array of number to be normalized to sum=1 poArg2 = true return equal probability poArg2 = false return random probability 9902231543 /**/ function probabOne(poArg1,poArg2) { var m0,m1,m2,m3; var rand1,rand2; var ans0=''; rand1=[0,0]; rand2=0; if(isNaN(poArg1)) //poArg1 is input box ID name { rand1=readdata(poArg1); //9811281500 if(poArg2) //9902231547 { m1=1/rand1.length; for(m0=0;m0<rand1.length;m0++) { ans0+=m1+'\n' } return ans0; //9902231550 } for(m0=0;m0<rand1.length;m0++) { if(rand1[m0]<0) { return 'Input box can not have negative number. \n' +'Probability must be positive or zero.'; } rand2+=rand1[m0]; //9811282130 } } else { poArg1=parseInt(poArg1); if(poArg2) //9902231551 { m1=1/poArg1; for(m0=0;m0<poArg1;m0++) { ans0+=m1+'\n' } return ans0; //9902231552 } for(m0=0;m0<poArg1;m0++) { rand1[m0]=Math.random(); //9811281509 rand2+=rand1[m0]; //9811282132 } } //if(isNaN(poArg1)) else //parameter is number if(rand1.length==2&&rand1[0]==0&&rand1[1]==0) { return 'Box 12, input box can not be empty\n' +'Please click [random5#] button first.'; //9811281545 } m1=rand2 //9811282133 for(m0=0;m0<rand1.length;m0++) { rand1[m0]=rand1[m0]/m1; //9811281516 } ans0=(''+rand1).replace(/,/g,'\n');//9811281518 return ans0; //9811281519 } //function probabOne(poArg1,poArg2) function stndrdth(i0) //9802141617 begin js code { var sth = [" ", "st", "nd", "rd", "th"]; if(i0<0) return sth[0]; if(i0%100>3&&i0%100<21) return sth[4]; if(i0%10==1) return sth[1]; if(i0%10==2) return sth[2]; if(i0%10==3) return sth[3]; return sth[4]; } //function stndrdth(i0) //9802141626 done js code //--> </script> <br> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <br> <br> <a name="sortnumb">&lt;a name="sortnumb"&gt;</a> <br> <font color=red size=+1>Sort number</font> not text string <br> <font color=red size=+1> Output may contain error, Please verify first. <br> Program environment is MSIE 6.0, please use MSIE </font> <br> <a name="sortClick"></a> <INPUT onclick='javascript: sortNumbMan(0); spanSort1.innerHTML="Output descending index. <font color=red><b>show permutation matrix</b></font>"' type=button value="Output New Index"><!--9807151815--> &nbsp; <INPUT onclick='javascript:bubbleMan(0),spanSort1.innerHTML="Output new eigenvalue sequence. Ignore eigenvector. Run by bubble_1()"' type=button value="Sorted Seq. 321"><!--9811240942 use [Seq. 321]--> <!--9807151816 use button [Output New Seq.]--> &nbsp; <INPUT onclick='javascript:bubbleMan(1),spanSort1.innerHTML="Output 1,2,3 increase value. [bubble_1() output 3,2,1 default]"' type=button value="Sorted Seq. 123"><!--9811240943 new add--> <br> <span id=spanSort1><font color=red> Box11 accept only numbers, not name list, not non-number string. </font></span> <br> <a name="ch01tb04"></a> <table border=0> <tr> <td> Box 71, input number sequence <br> <INPUT onclick='javascript:window.clipboardData.setData("Text",document.getElementById("boxc21").value.toString())' type=button value="copy71"> <INPUT onclick='document.getElementById("boxc21").value=""' type=button value="del71"> <INPUT onclick='boxc22.value=upsidedown2(boxc21.value),spanSort1.innerHTML="line unit reverse box 71 text, output to box 72. Number, text both OK."' type=button value="up side down"> <!--9809291951 upsidedown(), onclick='upsidedown()' 9811220924 upsidedown2() onclick='boxc22.value=upsidedown2(boxc21.value)' --> <br> <TEXTAREA id=boxc21 name=boxc21 rows=6 cols=30 > 0.556 -0.145 0.302e3 -0.305e2 -0.088 </TEXTAREA> </td> <td> Box 72, output answer <br> <INPUT onclick='javascript:window.clipboardData.setData("Text",document.getElementById("boxc22").value.toString())' type=button value="copy72"> <INPUT onclick='document.getElementById("boxc22").value=""' type=button value="del72"> <br> <TEXTAREA id=boxc22 name=boxc22 rows=6 cols=30 > Click [Output New Index] to get permutation matrix Click [Sorted Seq. 321] to get sorted data number </TEXTAREA> </td> </tr> </table> This file sort numbers, not for sort text; upsidedown text ok. <br> 2009-07-15-11-18 start sortNumb() <br> 2009-07-15-18-40 done sortNumb() <br> 2009-09-29-20-50 done upsidedown() <br> <SCRIPT language=JavaScript> <!-- //sortNumbMan() all ...Man() are MANager //function. Handle input/output. Other //programmer may not need this manager //function. //This manager function call main engine // ouArray=sortNumb(inArray) //Other programmer may want to use sortNumb() // 9807161228 function sortNumbMan(smArg1) //9807151818 { var inArray=readdata(boxc21.value); //9807151819 var sortedArr= //9906301554 sortNumb(inArray); //alert('typeof sortedArr='+(typeof sortedArr)+'\n9906301610'); var sortedStr= //9906301555 (''+sortedArr).replace(/,/g,'\n'); var i,j,k; //9906301556 create permute matrix var permutMat=new Array(inArray.length); //9906301557 for(i=0;i<inArray.length;i++) { permutMat[i]=new Array(inArray.length); for(j=0;j<inArray.length;j++) { permutMat[i][j]=0; if(j==sortedArr[i])permutMat[i][j]=1; } } var permut321=''; //9906301602 for(i=0;i<inArray.length;i++) { for(j=0;j<inArray.length;j++) { permut321+=permutMat[i][j]+' '; } permut321+='\n' } var permut123=upsidedown2(permut321); //9906301624 boxc22.value='' //9807151824 +sortedStr +'\n\n' +'Above is INDEX of descending\n' +'Below is permutation matrix.\n\n' +'Permut321 matrix=\n' +permut321 //9906301605 +'Permut321 * Box71 input seq.\n' +'get 321 descending output.\n' +'\n' +'Permut123 matrix=\n' +permut123 //9906301625 +'Permut123 * Box71 input seq.\n' +'get 123 ascending output.\n\n' +'Please copy/paste permutation\n' +'matrix to Box M1 (Not box 1)\n' +'Copy/paste Box 71 sequence\n' +'to Box M2. click [M*M Array]\n' +'Result show up at Box M3.\n' +'Suggest open second browser\n' +'for 2nd copy of jsmajor2.htm\n' ; } //9807151826 function sortNumbMan(smArg1) /** 2009-07-22-11-05 found old record 8902WK01.DLY [[ A tutorial on pointers and arrays in C 2000-02-16-01-57 http://www.netcom.com/~tjensen/ptr/pointers.htm save as pointer_01 to pointer_14 2000-02-16-02-05 http://home.netcom.com/~tjensen/ ]] 02/16/2000 02:04 AM 19,015 ch10x.htm /**/ //bubbleMan() all ...Man() are MANager //function. Handle input/output. Other //programmer may not need this manager //function. //This manager function call main engine // bubble_1(inArray, // inArray.length // ) //Other programmer may want to use bubble_1() // 9807161229 function bubbleMan(bmArg1) //9807151827 { var inArray=readdata(boxc21.value); //9807151819 bubble_1(inArray, inArray.length ) //output 3,2,1 if(bmArg1==1) { //output 1,2,3 inArray=upsidedown2((''+inArray).replace(/,/g,'\n')) //9811240949 } boxc22.value='' //9807151830 +(''+inArray).replace(/,/g,'\n'); } //9807151832 function bubbleMan(bmArg1) /** 9807161850 Assume input sequence is inNumb[]=[ 0.556 -0.145 0.302e3 -0.305e2 -0.088 ] then inNumb[0] store 0.556 inNumb[1] store -0.145 inNumb[2] store 302.0 inNumb[3] store -30.5 inNumb[4] store -0.088 then call newSeq=sortNumb(inNumb) get newSeq=[2,0,4,1,3] it means inNumb[2] store 302.0 greater than inNumb[0] store 0.556 greater than inNumb[4] store -0.088 greater than inNumb[1] store -0.145 greater than inNumb[3] store -30.5 newSeq=[2,0,4,1,3] this new sequence can be used to re-order eigenvalue and to re-order eigenvector 9807161856 stop 9807271355 start above inNumb[0] ... inNumb[4] old index is bb = [0,1,2,3,4] function sortNumb() main job is to change index to [2,0,4,1,3] If sort number directly, use if (aa[j] > aa[i]) sortNumb() sort number IN-directly sort number index bb[i] directly, use if (aa[bb[j]] > aa[bb[i]]) 9807271401 stop /**/ //function bubble(aa, N //9807151528 function sortNumb( //9807151528 aa //aa is input number sequence. ) { // 9807151612 and 9807151616 are two key points var N=aa.length; //9807151625 var bb=new Array(N); for(var m0=0;m0<N;m0++) bb[m0]=m0; //9807250842 //above line, create bb=[0,1,2,3,4] var i, j, k; for (i = 0; i < N-1; i++) { for (j = i+1; j <= N-1; j++) { // if (aa[j] > aa[i]) //from greatest to smallest if (aa[bb[j]] > aa[bb[i]]) //9807151616 { k=bb[i]; //9807151612 bb[i]=bb[j]; //9807151611 bb[j]= k ; //9807151613 } //if (aa[bb[j]] > aa[bb[i]]) } //for (j = i+1; j <= N-1; j++) } //for (i = 0; i < N-1; i++) return bb; // 9807161630 } //9807151617 function sortNumb() /** 9807271416 start loop command for (i = 0; i < N-1; i++) for (j = i+1; j <= N-1; j++) work as following assume input data is aa[0] = 0.556 aa[1] = -0.145 aa[2] = 302.0 aa[3] = -30.5 aa[4] = -0.088 original index is bb=[0,1,2,3,4] Goal is to find new order as below aa[2] = 302.0 aa[0] = 0.556 aa[4] = -0.088 aa[1] = -0.145 aa[3] = -30.5 right hand side of '=' is in great to small order new index is bb=[2,0,4,1,3] First enter outer loop for (i = 0; i < N-1; i++) Index [0,1,2,3,4] has five number, so N=5 i start from 0, 1, 2 to 3 . i not touch 4 ÿi < N-1 ÿ If i=4 then last number aa[4] no one to compete with aa[4] . Need at least reserve one number to compete with aa[i] Therefore, Five number sequence, i not reach 4 N number sequence, i not reach N-1 If it is just begin, i=0 . aa[0] is main role. Next see inner loop for (j = i+1; j <= N-1; j++) index j start from i+1=1 j goto 4 and stop. ÿj <= N-1 ÿ In inner loop, outer loop index i is constant, never change. Take aa[1],aa[2],aa[3],aa[4] One after one, compare with aa[0]. If it is just begin, old order is bb=[0,1,2,3,4] command if (aa[bb[j]] > aa[bb[i]]) is if (aa[bb[1]] > aa[bb[0]]) is if (aa[1] > aa[0]) is if (-0.145 > 0.556) Not true, not run if(true) commands Inner loop index j increase get j=2 At this time, outer loop index i still =0 command if (aa[bb[j]] > aa[bb[i]]) is if (aa[2] > aa[0]) is if (302.0 > 0.556) It is TRUE !! run if(true) commands k=bb[i]; bb[i] value store at k bb[i]=bb[j]; bb[i] receive bb[j] value bb[j]= k; bb[j] receive bb[i] value that is bb[i] and bb[j] exchange value. Before first exchange bb=[0,1,2,3,4] After first exchange bb=[2,1,0,3,4] bb[j] compare with bb[i] continue as above fashion. Until all done, get new index sequence bb=[2,0,4,1,3] command return bb; // 9807161630 send new index back to calling function. 9807271441 stop /**/ /* Program bubble_1.c from PTRTUT10.HTM 6/13/97 Ted Jensen Redwood City, California tjensen@ix.netcom.com July 1998 //9807151221 open C:\lc0\c_online\pointer\ch10x.htm void bubble(int a[], int N) */ function bubble_1(a, N // , bb //9807151249 bb store new sequence, but ) //failed, then have to write sortNumb() { // int i, j, t; var i, j, t; for (i = N-1; i >= 0; i--) { for (j = 1; j <= i; j++) { // if (a[j-1] > a[j]) //9807151238 change to next if (a[j-1] < a[j]) //from greatest to smallest { t = a[j-1]; a[j-1] = a[j]; a[j] = t; } } } } /*---------------------- end bubble_1.c -----------------------*/ /** 2009-07-22-11-10 open pointers.htm 2000-02-16-01-57 http://www.netcom.com/~tjensen/ptr/pointers.htm [[ A TUTORIAL ON POINTERS AND ARRAYS IN C by Ted Jensen Version 1.1 (HTML version) July 1998 This material is hereby placed in the public domain Available in various formats via http://www.netcom.com/~tjensen/ptr/cpoint.htm TABLE OF CONTENTS Preface Introduction Chapter 1: What is a Pointer? Chapter 2: Pointer Types and Arrays. Chapter 3: Pointers and Strings Chapter 4: More on Strings Chapter 5: Pointers and Structures Chapter 6: More on Strings and Arrays of Strings Chapter 7: More on Multi-Dimensional Arrays Chapter 8: Pointers to Arrays Chapter 9: Pointers and Dynamic Allocation of Memory Chapter 10: Pointers to Functions Epilog ]] /**/ /** //9809291954 if box11 has [[ 0.556 -0.145 0.302e3 -0.305e2 -0.088]] last line no newline byte, next line inStr0=boxc21.value+'\n'; do not help .split() know box11 last line no newline byte, even if I attach '\n', .split() still drop '\n' from last line. then after upside down first line (was list line and no newline byte) and second line string to one line. 98,09,29,20,36 record //9809292038 version two in output string add '\n', success ouStr0+='\n'; //9809292040 9809291951 upsidedown(), onclick='upsidedown()' 9811220924 upsidedown2() onclick='boxc22.value=upsidedown2(boxc21.value)' function upsidedown() /**/ function upsidedown2(udArg1) { //var inStr0=boxc21.value var inStr0=udArg1; //9811220928 var ouStr0=''; var p0,p1,p2; inStr0=inStr0.split('\n'); ouStr0=inStr0[inStr0.length-1]; if(ouStr0.charCodeAt(ouStr0.length-1)>=32) ouStr0+='\n'; //9809292040 for(p0=inStr0.length-2;p0>=0;p0--) { ouStr0+=inStr0[p0] //9809292048 +(inStr0[p0].charCodeAt(inStr0[p0].length-1)<32?'':'\n') //9811241012 solve problem ; } return ouStr0; //9811220929 }//9809292050 // function upsidedown2(udArg1) //--> </script> <pre><font size=+2> <a name="docB001">&lt;a name="docB001"&gt;</a> <a href="#docB042">h2</a> <!--9907291636--> 2010-07-24-07-00 start This page <a href=sumpart2.htm>sumpart2.htm</a> Abel s Summation by Parts<a href=http://freeman2.com/sumpart2.htm> http://freeman2.com/sumpart2.htm</a> is written when reading <a href=http://www-stat.wharton.upenn.edu/~steele/Publications/Books/CSMC/CSMC_index.html> The Cauchy-Schwarz Master Class</a><a href=http://www-stat.wharton.upenn.edu/~steele/index.html> J. Michael</a> <a href=http://www.wharton.upenn.edu/faculty/steele.html>Steele</a> <a href=http://www.amazon.com/review/product/052154677X/ref=cm_cr_dp_all_helpful?%5Fencoding=UTF8&coliid=&showViewpoints=1&colid=&sortBy=bySubmissionDateDescending>&&&&&</a> ISBN 978-0-521-54677-5 </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <pre><font size=+2><a name="docB002">&lt;a name="docB002"&gt;</a> Page control panel is next</font></pre> [10^] box is random number upper bound ¡%complex <br> 10^[1.2345] ; ¡%+/0 , ¡%+/0/- ; [5]digits; ¡%eq.p <br> fill [20] numbers; ¡%integer; b=a^[ ] Help1 <br> [Random] [Random+Random] [Random+Probability] <br> Box 1, a<sub>k</sub> copy1 del1 s1 s2 Box 2, b<sub>k</sub> copy2 del2 s3 s4 <br> m: [1] n: [20] [Summation by parts] [R+R] [d] [P.S.] [D.S.] <br> Box 3, output copy3 del3 Box 4, debug copy4 del4 <br> <a name="docB003">&lt;a name="docB003"&gt;</a> <br> equation in box 5 generate data sequence, use x as variable. <br> Box 5, [x*x ] [d5] <br> x bgn [0] ; x step [1] ; x end [10] [dx] [dm] &nbsp; //more <a href=tute0049.htm#ch14a137>01</a> <a href=tute0049.htm#ch14a153>02</a> <br> Output to box 1™" , 2™" ; [Build Seq.] [01] [02] [11] <br> [2%"x%"f"|sin(Àx)|] No À: [2%"x%"?f"?|sin(x)|] CSMC p.210,211 <br> <pre><font size=+2><a name="docB004">&lt;a name="docB004"&gt;</a> 2010-07-24-07-28 here Explain as following [[ [10^] box is random number upper bound ¡%complex ]] <a name="docB005">&lt;a name="docB005"&gt;</a> Random number is generated in the range [0,1] If you fill a number to [10^] box, for example "1.2345" program calculate 10^1.2345 pow(10,1.2345) 17.159317101209943 and stretch random from [0,1] to [0,17.159] <a name="docB006">&lt;a name="docB006"&gt;</a> ¡%complex check box is provided for generate complex random number only. This program do not use complex number. You can generate random complex here and use data in other application. <a name="docB007">&lt;a name="docB007"&gt;</a> [[ 10^[1.2345] ; ¡%+/0 , ¡%+/0/- ; [5]digits; ¡%eq.p ]] If check ¡%+/0, output nonnegative random number If check ¡%+/0/-, output negative or zero or positive random number <a name="docB008">&lt;a name="docB008"&gt;</a> If fill '5' to [5]digits; random has five digits If check ¡%eq.p and if click [Random+Probability] button box 2 output equal probability. It is one over n, n read from fill [20] numbers box. </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <pre><font size=+2><a name="docB009">&lt;a name="docB009"&gt;</a> [[ fill [20] numbers; ¡%integer; b=a^[ ] Help1 ]] If fill 20 to "fill [20] numbers" output 20 random numbers. If check "¡%integer", output integer random. <a name="docB010">&lt;a name="docB010"&gt;</a> If fill a number 2 to "b=a^[ ]" then Box 1 number raise to power 2 and save to box 2. b=a^[non-proportion] if fill a number then box 2 b<sub>k</sub> seq. is proportional to box 1 a<sub>k</sub> seq. Result is Holder's Inequality become equality. <a name="docB011">&lt;a name="docB011"&gt;</a> sumpart2.htm file structure copy from holder02.htm "b=a^[ ]" function is preserved in sumpart2.htm You can generate proportional data and use at other application. Click "Help1" come to this help document section. <a name="docB012">&lt;a name="docB012"&gt;</a> [[ [Random] [Random+Random] [Random+Probability] ]] are three click buttons to generate random numbers [Random] generate random to box 1 <a name="docB013">&lt;a name="docB013"&gt;</a> [Random+Random] generate random to box 1 and box 2 [Random+Probability] generate random to box 1 and box 2. Box 1 numbers not sum to one. Box 2 numbers DO sum to one Box 2 numbers are all nonnegative. <a name="docB014">&lt;a name="docB014"&gt;</a> [[ Box 1, a<sub>k</sub> copy1 del1 s1 s2 Box 2, b<sub>k</sub> copy2 del2 s3 s4 ]] Two input boxes for data [s1] sort box 1 data to 321 [s2] sort box 1 data to 123 [s3] sort box 2 data to 321 [s4] sort box 2 data to 123 </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <pre><font size=+2><a name="docB015">&lt;a name="docB015"&gt;</a> [[ m: [1] n: [20] [Summation by parts] [R+R] [d] [P.S.] [D.S.] ]] Please see summation by parts <a href="#ch14a073">equation</a> <a name="docB016">&lt;a name="docB016"&gt;</a> sum start from m, end at n. m and n are defined at "m: [1] n: [20]" boxes If fill "m: [30] n: [20]" program can not sum from 30th element to 20th element. Box 3 report error "m>n, 30>21" <a name="docB017">&lt;a name="docB017"&gt;</a> If fill "m: [12] n: [20]" If fill box 1 with only 5 data program can not sum from 12th element to 20th element. Box 3 report error "m>L, 12>5" <a name="docB018">&lt;a name="docB018"&gt;</a> <font color=red><b>[Summation by parts] button is the main button of this file. [Summation by parts] button is wider, two lines.</b></font> [R+R] generate random number to box 1 and 2. Same as the other one [Random+Random] [d] delete message, box 3 and 4 <a name="docB019">&lt;a name="docB019"&gt;</a> [P.S.] build partial sum for box 1 data and save to box 3 If box 1 has [ 10 8 14 9 3] box 3 get [ 10 18 32 41 44]<font color=red><b> Discrete partial sum H" integration</b></font> [D.S.] build Difference for box 1 Sequence.get [ -2 6 -5 -6 ]<font color=red><b> Discrete difference H" differentiation</b></font> <a name="docB020">&lt;a name="docB020"&gt;</a> [[ Box 3, output copy3 del3 Box 4, debug copy4 del4 ]] both box 3 and 4 are output/debug </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <pre><font size=+2><a name="docB021">&lt;a name="docB021"&gt;</a> [[ equation in box 5 generate data sequence, use x as variable. ]] a message line <a name="docB022">&lt;a name="docB022"&gt;</a> [[ Box 5, [x*x ] [d5] x bgn [0] ; x step [1] ; x end [10] [dx] [dm] ]] Create a math equation in box 5 <a name="docB023">&lt;a name="docB023"&gt;</a> Fill in range data x bgn [0] ; x step [1] ; x end [10] click [Build Seq.] button Program generate data to box 1 For example, if Box 5, [x*x ], if x bgn [0] ; x step [1] ; x end [10] click [Build Seq.] button <a name="docB024">&lt;a name="docB024"&gt;</a> box 1 has next data [[ 0 1 4 9 16 25 36 49 64 81 100 ]] <a name="docB025">&lt;a name="docB025"&gt;</a> Box 4, debug has the equal space x sequence. "0,1,2,3,4,5,6,7,8,9,10" If you use equation [ x ] then box 1 output same as "0,1,2,3,4,5,6,7,8,9,10" but one number one line. <a name="docB026">&lt;a name="docB026"&gt;</a> Above is equal step length. If you delete either one of x bgn [0] ; x step [1] ; x end [ ] Program read input sequence from box 4. Plug into box 5 equation output to box 1 with alert<font color=red><b> read x value from box 4 for un-equal step length.</b></font> This design allow user create non-equal step sequence. <a name="docB027">&lt;a name="docB027"&gt;</a> [dx] delete x bgn/step/end at one click. [dm] delete red line message. </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <pre><font size=+2><a name="docB028">&lt;a name="docB028"&gt;</a> [[ Output to box 1™" , 2™" ; [Build Seq.] [01] [02] [11] ]] [Build Seq.] button main purpose is create sequence for Abel s Summation by Parts input data. <a name="docB029">&lt;a name="docB029"&gt;</a> Summation by Parts need two seq. The choice Output to box 1™" , 2™" allow user to send sequence to proper input box. <a name="docB030">&lt;a name="docB030"&gt;</a> [Build Seq.] button to create sequence. [01] [02] [11] are three example buttons [01] create Box 5, x x bgn asin(1) ; x step PI/10 ; x end acos(-1) Click [Build Seq.] button build sequence to box 1 <a name="docB031">&lt;a name="docB031"&gt;</a> Main point is to show x bgn x step x end three boxes has calculation function. It is ok to fill in math expression. <a name="docB032">&lt;a name="docB032"&gt;</a> [02] create Box 5, x x bgn E ; x step E ; x end exp(1.2*E) Click [Build Seq.] button build sequence to box 1 E is reserved symbol, E value is 2.718281828459045 <a name="docB033">&lt;a name="docB033"&gt;</a> [01] and [02] illustrate math expression for x bgn/step/end [11] button is for [2%"x%"f"|sin(Àx)|] (not for data illustration) <a name="docB034">&lt;a name="docB034"&gt;</a> [11] create x bgn 0.5 ; x step 1 ; x end 8 The input data is "0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5" Click [2%"x%"f"|sin(Àx)|] button Box 3, output all "1 1" first '1' is 2%"x%"=2*0.5=1 second '1' is sin(2.5*PI)=1 </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <pre><font size=+2><a name="docB035">&lt;a name="docB035"&gt;</a> Special sequence that 2%"x%"=|sin(Àx)| If click [11] then click [2%"x%"?f"?|sin(x)|] button Box 3, output all "***" =violate result. Because 2%"x%" f" |sin(Àx)| is true 2%"x%"?f"?|sin( x)| is error <a name="docB036">&lt;a name="docB036"&gt;</a> Both 2%"x%" and |sin(Àx)| have same period 1, amplitude 1. But 2%"x%" and |sin( x)| have different period 1 |sin( x)| period is PI, not 1. //more <a href=tute0049.htm#ch14a137>01</a> <a href=tute0049.htm#ch14a153>02</a> <a name="docB037">&lt;a name="docB037"&gt;</a> [[ [2%"x%"f"|sin(Àx)|] No À: [2%"x%"?f"?|sin(x)|] CSMC p.210,211 ]] are two run buttons. Reference is CSMC p.210,211 <a href=http://www-stat.wharton.upenn.edu/~steele/Publications/Books/CSMC/CSMC_index.html> The Cauchy-Schwarz Master Class</a><a href=http://www-stat.wharton.upenn.edu/~steele/index.html> J. Michael</a> <a href=http://www.wharton.upenn.edu/faculty/steele.html>Steele</a> <a href=http://www.amazon.com/review/product/052154677X/ref=cm_cr_dp_all_helpful?%5Fencoding=UTF8&coliid=&showViewpoints=1&colid=&sortBy=bySubmissionDateDescending>&&&&&</a> ISBN 978-0-521-54677-5<!--9807061815 add ISBN--> 2010-07-24-08-56 stop <a name="docB038">&lt;a name="docB038"&gt;</a> 2010-07-24-12-23 start Why Discrete 2<sup>n</sup> is an analogue of continuous e<sup>x</sup> ? We know d[exp(x)]/dx = exp(x) What is the discrete version of above equation? Please goto <a href="#buildSequence">Box 5</a>, fill pow(2,x) to Box 5. It is f(x)=2^x but we use it for discrete problem. Set x range x bgn 0 ; x step 1 ; x end 10 <a name="docB039">&lt;a name="docB039"&gt;</a> Click [Build Seq.] button Box 1 get value [[ 1 2 4 8 16 32 64 128 256 512 1024 ]] <a name="docB040">&lt;a name="docB040"&gt;</a></font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <pre><font size=+2>then click [D.S.] button Box 3 get value [[ 1 2 4 8 16 32 64 128 256 512 ]] <a name="docB041">&lt;a name="docB041"&gt;</a> This experiment show that difference of 2<sup>n</sup> is same as 2<sup>n</sup> (short one element)<font color=red><b> Discrete 2<sup>n</sup> is an analogue of continuous exp(x).</b></font> 2010-07-24-12-33 stop <a name="docB042">&lt;a name="docB042"&gt;</a> <a href="#docB047">[rand a+ib]</a> 2010-07-28-19-20 start Update 2010-07-28 add two click buttons [exp(ix)] and [exp(iy)]. Both are tool for CSMC Problem 14.2 <a href=tute0049.htm#ch14a177>CSMC page 212 line 5</a> say "if set complex number c<sub>n</sub> to exp(2Àit) <a href=tute0049.htm#ch14a170>eqn.14.9</a> simplify to <a href=tute0049.htm#ch14a180>eqn.14.10</a>" <a name="docB043">&lt;a name="docB043"&gt;</a> Without [exp(ix)] and [exp(iy)] buttons, box 5 equation can not create complex number. <a name="docB044">&lt;a name="docB044"&gt;</a> [exp(ix)] read x bgn,x step,x end three values, (ignore box 5 value) create cos(x)+i*sin(x) complex sequence. Output to box 1 complex only Output to box 2 javascript code to define complex sequence. If click [dx] to delete x bgn, x step,x end. and click button [exp(ix)]. Program read x points from box 4. </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <pre><font size=+2><a name="docB045">&lt;a name="docB045"&gt;</a> CSMC page 210, <a href=tute0049.htm#ch14a109>eqn.14.7</a> "[k=1,M]exp(i2À(k*k+b*k+c)/N) require 0f"MÿN and page 212 line 22 <a href=tute0049.htm#ch14a201>eqn.14.13</a> use complex number which is generated by exp(i*2PI*(k*k+b*k+c)/N) Boxes x bgn,x step,x end can not do this work. <a name="docB046">&lt;a name="docB046"&gt;</a> If click button [exp(iy)]. Program read b,c,M,N from box 4 and ignore x bgn, x step,x end boxes value Create complex numbers, output to box 1 and box 2. 2010-07-28-19-50 stop <a name="docB047">&lt;a name="docB047"&gt;</a> 2010-07-29-16-00 start Update 2010-07-29 add one click button [rand a+ib]. Previous two buttons [exp(ix)] and [exp(iy)] build complex number with absolute value equal to one only. Button [rand a+ib] will build complex number with absolute value not equal to one. In some application you may need this function. <a name="docB048">&lt;a name="docB048"&gt;</a> If you want to see the drawing of complex numbers, please copy complex numbers from this page sumpart2.htm "Box 1, a<sub>k</sub>", paste to<a href=http://freeman2.com/tute0014.htm#fig2.5> http://freeman2.com/tute0014.htm#fig2.5</a> "Box 1 a+i*b" (<a href=tute0014.htm#fig2.5>local</a>) In tute0014.htm click [plot3] button to get complex number graph. (MSIE only) <a name="docB049">&lt;a name="docB049"&gt;</a> tute0014.htm also have random complex generator. but if you use randoms at "Box 2, b<sub>k</sub>" from sumpart2.htm and want to see them. You must copy from "Box 1, a<sub>k</sub>" (NOT from "Box 2, b<sub>k</sub>" "Box 2, b<sub>k</sub>" has javascript code) and paste to tute0014.htm. tute0014.htm do not have the javascript code output. 2010-07-29-16-20 stop <a name="docB050">&lt;a name="docB050"&gt;</a> 2010-08-05-17-35 start Update 2010-08-05 add one click button [<a href=#buildSequence>h3</a>]. If click [h3], box 3 and box 4 print help message inform how to use [exp(ix)], [exp(iy)], [rand a+ib] and [2%"x%"f"|sin(Àx)|] [2%"x%"?f"?|sin(x)|] where is input and where is output. 2010-08-05-17-39 stop </font></pre> <script type="text/javascript"><!-- document.write(link0); //9907251151 //--></script> <br> <hr><br> <a name="jsIndex"></a> Javascript index <br> <a href=http://freeman2.com/jsindex2.htm> http://freeman2.com/jsindex2.htm </a> &nbsp; <a href=jsindex2.htm> local </a> <!--9810201450 add local link--> <br> Save graph code to same folder as htm files. <br> <a href=http://freeman2.com/jsgraph2.js> http://freeman2.com/jsgraph2.js </a> &nbsp; <a href=jsgraph2.js> local </a> <br> <script src="jslist1e.js" language="javascript"></script> <br> <br> <!--9901211429--> File name sumpart2.htm means <br> Summation by parts English .htm <br> <br> This page, Summation by parts <br> <a href=http://freeman2.com/sumpart2.htm> http://freeman2.com/sumpart2.htm </a> <br> First Upload 2010-07-25 <br> <br> Thank you for visiting Freeman's page.0 <br> Freeman 02010-07-25-12-13 <br> <br> <span id="tuteLink2"></span> </BODY> </HTML> <!-- 99,07,16,21,01 copy tute0048.htm tute0049.htm 99,07,18,18,17 save tute0049.htm as sumpart2.htm -->