Random number, power number generator
program   Update 2009-10-05  
XYGraph v2.3 - web page graph   ☜☞   donate   get code
The Cauchy-Schwarz Master Class   J. Michael Steele   ★★★★★
This file is personal home work. No one
proofread. Cannot promise correctness.
If you suspect any view point wrong,
please ask a math expert near by.
Freeman 2009-06-19-10-46

Please use MSIE browser to read this file.
Did not test other browser. This file is
written under MSIE 6.0



<a name="docA001">
2009-06-08-19-10 start
This file http://freeman2.com/tute0008.htm
is Freeman's reading notes. Although Freeman
always keep correct view point. But Freeman's
capability is limited, plus no one proofread
this file. Then you can still find wrong view
point. When read, please put question mark as
often as possible. If you suspect any view 
point wrong, please ask a math expert near by.

<a name="docA002">,<a name="textbook">
This file is a note for reading inequality
book written by Professor J. Michael Steele
The Cauchy-Schwarz Master Class   ★★★★★
Below use 'textbook' as abbreviation.
Freeman also read web pages online, and will 
indicate the source URL at discussion point.

<a name="docA003">
Freeman study mechanical engineering. 
Engineering mathematics do not teach 
inequality. Above book is first inequality
book. First time read, it was very hard.
Although high school time learned
  a*a + b*b >= 2*a*b
But this little knowledge do not help.

<a name="docA004">
This file follow textbook chapter section
order, but not continuous, Freeman skip 
those uncertain sections/problems.

This file first function is to learn 
inequality. Second function is to learn
how to use html code to write math 
equations.

<a name="docA005">
On 2009-01-27-10-08 Freeman accessed
the next page
http://www.sftw.umac.mo/~fstitl/10mmo/inequality.html
save as sftw.umac.mo_text_math_eqn_good.htm
Above page is the main reference for html
math equation.

In order to let reader to build  html math
equation, previous file tute0007.htm page 
end has math symbol and internal code.

This file third function is to display how
to draw curves in web page. The main engine
is XYGraph v2.3 - Technical Figures

Thank you for read Freeman's inequality page.
2009-06-08-19-47 stop

<a name="docA006">
2009-08-23-15-00 start
□ Exercise 1.14 solution

Exercise 1.14 problem (a) is solved by hint
Exercise 1.14 problem (b) is out of LiuHH's
reach. What is "cardinality of a set B⊂Z3" ?
Without clear understand the definition, 
LiuHH is unable to solve problem (b)
LiuHH major in mechanical engineering.
LiuHH is mathematics admirer and outsider.

<a name="docA007">
To solve problems in
The Cauchy-Schwarz Master Class
LiuHH's goal is to solve 50% of the exercise
problems. In reality, solve 40% is good enough.
Please do not be surprise that LiuHH skip some
text section, skip some problems.
2009-08-23-15-12 here

Random number, power number generator
Arithmetic Mean and Geometric Mean of a number sequence
Output may contain error, Please verify first.
Program environment is MSIE 6.0, please use MSIE

Box 1 input   Calculator local

Carleman's inequality require input sequence infinite sum be bounded.
a,b,c;d
help_1 , 1/E ; 123 , 321
10^ ; +/0 , +/0/- ; digits
fill numbers; integer; power
Bgn ,# Step ,End
Set power value < -1, click [powData] get bounded sequence.
Box 2 output   Calculator local

You can click "Carleman" button, test any input sequence,
observe its Gradual GMed sum and Gradual AMed sum.
But only infinite and convergent sequence can be called
Carleman's inequality. LiuHH 2009-10-02-22-56

<a name="sortnumb"> 
Sort number not text string
Output may contain error, Please verify first.
Program environment is MSIE 6.0, please use MSIE

 
Box11 accept only numbers, not name list, not non-number string.

Box 11, input number sequence

Box 12, output answer

This file sort numbers, if it were sort string, then e2, e3 go wrong.
2009-07-15-11-18 start sortNumb()
2009-07-15-18-40 done sortNumb()
2009-09-29-20-50 done upsidedown()

<a name="docA011">
2009-09-29-15-39 help_1
Program
Arithmetic Mean and Geometric Mean of a number sequence 
usage is as following.
Box 1 is input. Paste numbers into box 1.
Box 2 is output. There are two programs.
First  AM/GM inequality 
Second Carleman's inequality 
<a name="docA012">
There are three buttons for them
"AM GM 1"    it run amgmf1(boxc01.value,1)
"Carle man1" it run amgmf1(boxc01.value,2)
Above two buttons run function amgmf1()
"Carle man2" it run carlemanf2()

"Carle man1" read user supplied arbitrary data
"Carle man2" create monotone increase/decrease
data

<a name="docA013">
"Carle man1" use Gradual GMed sum <= E*INput sum
"Carle man2" drop E=2.718281828459045...
for monotone increase data change E to a value
less than one, for example 0.9, still perfect.
       Gradual GMed sum <= 0.9*INput sum
for monotone decrease data need E to rise input
data sum over Gradual GMed sum.
"Carle man2" main purpose is to see the ratio of
Gradual GMed sum / INput sum (no E here)


<a name="docA014">
There are four debug checkbox. dbg a,b,c;d.
"AM GM 1" do not use debug checkbox
"Carle man1" use dbg a,b,c three checkbox
"Carle man2" use dbg d one checkbox
If check box are unchecked. Output less material
and run faster for shorter information.
If check box are checked. Output more material
and run slower for detail information.
"dbg" button is all-clear button, not all-check.
<a name="docA015">
dbg a checked, "Carle man1" output input sequence
      and gradual GMed number sequence.
dbg b checked, "Carle man1" output carlrite
      that is input sequence related output.
      include echo print input sequence, make
      sure program read right data.
dbg c checked, "Carle man1" output carlleft
      include carlpart, carlpart is long string
      debug data.
dbg d checked, "Carle man2" output longer output.

<a name="docA016">
α box and ω box are add for "Carle man1" use.
If α box fill a number 
     0<=alpha<=1/log(2)=1.4426950408889633
"Carle man1" use alpha to lower input sum
reference is next
[[
2009-09-02-22-06 LiuHH access
http://www.emis.de/journals/JIPAM/images/029_00_JIPAM/029_00_www.pdf
page 9/10 theorem 3.2 
]]

<a name="docA017">
ω box has no theory base. ω simply add to right
hand side of
 Gradual GMed sum <= E*INput sum
as
 Gradual GMed sum <= ω*E*INput sum
If set ω=1/E=0.36787944117144233 then equation
become
 Gradual GMed sum <= INput sum
Check box 1/E fill 1/E=0.36787944117144233 for 
you.

<a name="docA018">
The remaining boxes/buttons create data for you.
"equal #" create equal numbers. It take number 
         from "10^" box and repeat fill-box times.
         output to box 1 as input data.
"random#" create random numbers.
"10^" box determine random number order of magnitude.
"+/0" box checked, output positive/zero random numbers.
"+/0/-" box checked, output +/0/- random numbers.
"digits" box determine the length of each random number.
"fill" box determine build how many random number.
"integer" checkbox force output integer.
"123" checkbox sort random number to increase order.
"321" checkbox sort random number to decrease order.

<a name="docA019">
"powData" button create x^power data.
"bgn" box is begin value.
"# Step" box determine how many step to divide.
"End" box determine stop value.
"power" box determine power in x^power.
If set same value to "bgn" box "End" box 
output constant data.

"Carle man2" button automatically click "powData"
button and read data.

This is designed for you to build random data
or build power data, and not necessary to use
data here. You can build data and copy box1 
value, use data in other application.

<a name="docA020">
Box11 and box12 has nothing to do with AMGM or
Carleman inequality. Program ("123", "321")
use function bubble_1(). Add few more line, 
build box11,12, let you to sort number. 
A handy tool.
2009-09-29-16-32 stop

<a name="docA021">
2009-09-29-20-58 start
2009-09-29 add "upside down" function. 
Purpose is to reverse increase/decrease
numbers. Text (non-number) can be reversed
too.
"123", "321" checkbox care only this program
generated data. If you have your own
increase/decrease data and want to reverse
them, "123", "321" checkbox can not help.
"up side down" button will help you with
your data.
2009-09-29-21-02 stop

<a name="docA022">
2009-09-29-21-10 start
Alert !!
Both Arithmetic Mean and Geometric Mean
inequality and Carleman inequality work
with positive or zero number only. This
page allow you to create sequence contain
negative number. You can create number 
sequence here and use them in other place.
If you use number sequence right here for
AM/GM or Carleman inequalities, it is your
responsibility not to generate negative
number!
2009-09-29-21-15 stop

<a name="docA023">
2009-09-30-07-33 start
On 2009-09-30-00-51 write function carlemanf3()
The button is "Carle man3". Main point is to
involve sum of Gradual AMed sequence.
Define
IN = sum of INput sequence
GA = sum of Gradual AMed sequence
GG = sum of Gradual GMed sequence
Carleman's inequality in brief is GG<=E*IN
Many test show GG/IN  far  below E=2.718281828459045...
Carleman3 show GA/IN still below E=2.718281828459045...
(AM >= GM, thefore  GA/IN >= GG/IN )

carlemanf3() output 
INput sequence
Gradual AMed sequence
Gradual GMed sequence
and sum each, find GG/IN GA/IN two ratio.

function carlemanf3() help thinking.
2009-09-30-07-41 stop

<a name="docA024">
2009-09-30-08-03 start
If you have a set test data pasted to box 1.
Click "Carle man1", program read your data.
Click "Carle man3", program read your data.
But
Click "Carle man2", your input data changed
you may be surprised and wondering what is 
going on?

"Carle man2" button read data from "powData"
related data, Bgn box, # Step box, End box, 
power box all contribute to "Carle man2" 
button. "powData" generated data send to 
box 1 and erase previous value. 
"Carle man2" button main point is to test
monotone increase or monotone decrease data.
If your data is not generated from "powData"
button do not touch "Carle man2" button.
2009-09-30-08-12 stop

<a name="docA025">
2009-10-05-12-36 start
Update 2009-10-05 correct GM error.
nineth draft and before
tute0012a09.htm output GM correct.
tenth draft and after
tute0012a10.htm output GM wrong.

<a name="docA026">
correct code is
[[
j1=1/len0;

for(j0=0;j0<len0;j0++)
  {
am0+=inp0[j0]/len0;
gm0*=Math.pow(inp0[j0],j1); //9809261046
  }
]]

<a name="docA027">
wrong code is
[[
j1=1/len0;

spanAlert1.innerHTML=''; //9809291518
j1=0;
for(j0=0;j0<len0;j0++)
  {
if(inp0[j0]<0)j1=1; //9809291521
am0+=inp0[j0]/len0;
gm0*=Math.pow(inp0[j0],j1); //9809261046
  }

if(j1==1)
spanAlert1.innerHTML=''  //9809291518
+'<font color=red>ALERT ! box1 has negative number! AMGM do not treat negative!</font>'
;
]]

<a name="docA028">
wrong code re-use j1 for different purpose.
for three element sequence q3=[1,3,9] its 
GM = (1*3*9)^(1/3) = 27^(1/3) = 3
correct code assign
j1=1/len0;  that is  j1=1/3
use j1 in
gm0*=Math.pow(inp0[j0],j1); //9809261046
get correct answer.
Wrong code change j1 definition to j1=0
then
gm0*=Math.pow(inp0[j0],j1);
is
gm0*=Math.pow(inp0[j0],0);
always get 1, wrong.

<a name="docA029">
On 2009-09-29-15-?? LiuHH add code to warn
negative value element. The flag used is 
again j1 (here wrong!!), j1 is redefined.
Because GM answer is already correct, LiuHH
pay attention to correct warning, and forget
to check GM answer.

<a name="docA030">
2009-10-05-11-18 found GM answer is wrong!
read code, find out the redefinition error.

change
j1=1/len0; 
gm0*=Math.pow(inp0[j0],j1); //9809261046
to
gmPow=1/len0; 
gm0*=Math.pow(inp0[j0],gmPow); //9810051143
solve problem
2009-10-05-12-52 stop


<a name="docA101"> 2009-09-29-17-29 start This file freeman2.com/randpow2.htm is random number, power number generator. This file is taken from inequality page 6 freeman2.com/tute0012.htm The main function of this program is actually Arithmetic Mean and Geometric Mean inequality and Carleman's inequality. In some application need to generate random number or power number The minor function of this program do this job. random number usage is at docA018 power number usage is at docA019 Both inequality usage at docA011 Program is at program0 Arithmetic Mean and Geometric Mean inequality theory is at tute0011.htm#ch02a066 Carleman's inequality theory is at freeman2.com/tute0012.htm At write time (2009-09-29) Carleman's ineq. theory not start yet. 2009-09-29-17-55 stop






Javascript index
http://freeman2.com/jsindex2.htm
Space Curve Projector
http://freeman2.com/curve3d2.htm
foot of perpendicular
http://freeman2.com/eyefoot2.htm
Gram-Schmidt Process
http://freeman2.com/gramsch2.htm
complex polynomial root
http://freeman2.com/polyroot.htm
complex variable functions
http://freeman2.com/complex2.htm
Hilbert's Inequality and Schur Constant
http://freeman2.com/tute0009.htm
Positive Integer power sum COefficient equation.
http://freeman2.com/jspico_e.htm
∑i^1 i=1 to n; up to ∑i^14 i=1 to n
http://freeman2.com/jspico2e.htm
Binomial factorial, double factorial
http://freeman2.com/binomial.htm
Prime number and prime decomposition
http://freeman2.com/jsprime2.htm

Random number, power number generator
http://freeman2.com/randpow2.htm
First upload 2009-09-29

Thank you for visiting Freeman's page. 
Freeman  2009-09-29-17-59

≦ ≠ ≧ <=>±≡≈≌≒∏∑√∛∜∝∞⊕⊙
〈v,w〉∈∀∂⊥∃∋∆∇∟∠∫∬∭∮∥○●◎ 
∧∨∩∪∴∵∶∷⊂⊃⊄⊅⊆⊇⊿+-*/
§‰¼½¾ ⅓⅔⅕⅖⅗⅘⅙⅚⅛⅜⅝⅞⅟←↑→↓↔↕↖↗↘↙
■□ ▢▣▤▥▦▧▨▩▪▫
ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ΢ΣΤΥΦΧΨΩ
ΪΫάέήίΰ αβγδεζηθικλμνξοπρςστυφχψω