<a name="fig2.5">How to use cauchyce.htm
Program environment is MSIE 6.0, please use MSIE
If you save this file cauchyce.htm to your computer
and open local cauchyce.htm, it can not draw figure.
You need also save http://freeman2.com/jsgraph2.js
to your computer stay in same folder as cauchyce.htm.
Graph area size,
W:
H:
figure down below
x min:
, x max:
; y min:
, y max:
;
x/y min/max :
auto scale,
user scale
Help2
Much longer vector 〈v,w〉 and 〈u,w〉 :
shrink,
unchange
Point Label:
Graph title:
Box 1 a+i*b
Box 3 message
Number separator selection is important, if wrong, no answer.
Box 2 polar
How to use cauchyce.htm
Above auxiliary control panel, x/y max/min and board size
Below main control panel, input v & w seq. Click [Plot9] to run.
Box21 V seq.
Box22 W seq.
Test
Box21 and box22 are both input.
complex separator:
';'
','
tab
newline
blank
Box21
save to Box22 for Cauchy equality.
Box23
RUN ==>
complexCauchyF( )
You can not draw other curve here. But you can
goto [Modify 606] define your equation
and click [Draw] within yellow stripe.
(Do not click [Draw 606]) 2009-10-08-17-08
Box31 debug 9811101743
Box32 debug 9811101758
<a name="autoscale">fig2.5
2009-10-14-21-57 changed code, add
auto scale, user scale options.
Suggest let auto scale run first, then
use user scale for fine tuning to get
better x/y min/max.
<a name="ch04b119">Index beginIndex tute0017.htm
2009-11-09-12-21
The following is copied from tute0017.htm
this discussion use the example problem
v='1+2i'; and w='3-4i';
vw=cdotf(v,w)='-5+10i'
2009-11-09-12-25
estimate time about 2009-11-05-14-10 here
■ Explain the whole story
as following.
Original problem is
Let v,w be complex numbers, find
|〈v,w〉|≦〈v,v〉1/2〈w,w〉1/2 ---eqn.4.18
but we find
Re〈v,w〉≦〈v,v〉1/2〈w,w〉1/2 ---eqn.4.20
where Re〈v,w〉 is real part of
vw = cdotf(v,w) = -5+10i
<a name="ch04b120">
that is
Re〈v,w〉=-5
We want |-5+10i| = 11.180
we do not want Re〈v,w〉=-5
We want the whole vector (-5+10i) length
we do not want vector projection on x axis.
<a name="ch04b121">
〈v,w〉=-5+10i, which has phase angle
2.0344439357957027 rad.
If we reverse rotate 〈v,w〉=-5+10i an angle
of negative of 2.0344439357957027 rad
then vector 〈v,w〉=-5+10i rotate to
vector 11.180+0i , new vector's projection
on x axis is its whole length 11.180 !!
"make 〈v,w〉 real" is our main goal.<a name="ch04b122">
Next, how can we rotate 〈v,w〉?
let s=〈v,w〉, write complex numbers v,w,s
in polar form (p_something = polar form)
v='1+2i' ==> pv=2.236*exp(1.107)
w='3-4i' ==> pw=5*exp(-0.9273)
s=-5+10i ==> ps=11.180*exp(2.034)
complex conjugate of w is
wj='3+4i' ==> pwj=5*exp(+0.9273)
<a name="ch04b123">
then
s=〈v,w〉
ps_length = pv_length*pwj_length=2.236*5=11.180
ps_phase = pv_phase +pwj_phase =1.107+0.9273=2.034
We want to rotate s, both pv and pwj
contribute s rotation. Now we hold
w unchange, pwj_phase keep constant,
<a name="ch04b124">
rotate v (pv) only, then
ps_phase=pv_phase+CONSTANT_pwj_phase
formula tell us that
ps_phase_change = pv_phase_change
We want ps_phase change to zero rad.
so that vector s has no imaginary
component.
<a name="ch04b125">
We choose phase_change to be -ps_phase,
then
ps_phase_change = pv_phase_change
become
ps_phase - ps_phase = pv_phase - ps_phase
get
ps_zero_rad_phase = pv_phase - ps_phase
<a name="ch04b126">Index beginIndex this file
■ Create second problem
With this understanding, next we create
second problem.
Second problem's answer is different
from first problem's answer, with
better and complete result.
Let w='3-4i'
define u replace v, such that
polar form of u = polar form of v - ps_phase
(v is given for first problem
u is fabricated for second problem)
<a name="ch04b127">
Next three lines achieve this goal.
pu=cpolr(v); //u start = v (polar form)
pu[1]=pu[1]-pvw[1]; //rotate reverse theta degree
u=cxryi(pu); //create new v => u, |u|=|v|
Explain above three lines as below.
pu=cpolr(v);
is u start = v and it is in polar form.
<a name="ch04b128">
Next line is rotation - ps_phase rad.
pu[1]=pu[1]-pvw[1]; //'s' is 'vw', s=〈v,w〉
//in polar expression pu[0]=vector length
//and pu[1]=vector phase angle
after rotation, recover real+imag*i form
u=cxryi(pu);
Now u value is 1.3416-1.7888i
which is point D in tute0014.htm#fig2.5
<a name="ch04b129">
We just found u and w is given, now
we create 〈u,w〉, code line is
uw=cdotf(u,w)//u dot w get real only
uw //uw value is 11.180 + zero (e-16)
11.180339887498949,-8.881784197001252e-16
we know 〈u,w〉 has only real component.
〈u,w〉=Re〈u,w〉=|〈v,w〉| ---eqn.AK058
is true,
left equality come from 〈u,w〉 has only
real component
right equality come from vector 〈v,w〉
and vector 〈u,w〉 just rotate, their
vector length are the same value.
<a name="ch04b130">
Next see
|〈v,w〉|=Re〈u,w〉≦〈u,u〉1/2〈w,w〉1/2
=〈v,v〉1/2〈w,w〉1/2 ---eqn.AK059
eqn.AK059 first line equality come
from above mentioned eqn.AK058.
eqn.AK059 first line inequality come
from Cauchy-Schwarz inequality. In
this part Re〈u,w〉 is actually |〈u,w〉|
because 〈u,w〉 has no imaginary part.
"make 〈v,w〉 real 〈u,w〉" is our main
goal.<a name="ch04b131">
eqn.AK059 first line to second line come
from the fact that u vector and v vector
are same length, they just rotate apart.
When take norm, both u and v have same
length.
eqn.AK059 beginning and ending form
|〈v,w〉|≦〈v,v〉1/2〈w,w〉1/2 ---eqn.AK060
<a name="ch04b132">
This is our answer.
Both v and w are complex number. We
can not compare v and w for inequality.
Only their real property (norm, length)
can be compared.
Hope above analysis will help you
understand.
2009-11-05-15-06 stop
<a name="docB001">
2009-11-09-17-33 start
Above is copied from
http://freeman2.com/tute0017.htm#ch04b119
The following introduce cauchyce.htm usage.
From <a name="fig2.5"> to [Box 2 polar] is
auxiliary control panel. It contains less
frequent used
<a name="docB002">
Graph area size, W: H:
x min: , x max: ; y min: , y max:
x/y min/max : □auto scale, □user scale Help2
Much longer vector 〈v,w〉 and 〈u,w〉 : □shrink, □unchange
Point Label:
Graph title:
Box 1 a+i*b
Box 2 polar
<a name="docB003">
Graph area boxes let you decide graph board
dimension. The default size is 500 * 500
x min: , x max: ; y min: , y max: boxes
let you decide x-axis and y-axis range.
You must click check [user scale] before
use this range function.
<a name="docB004">
x/y min/max : □auto scale, □user scale
Let you decide auto scale or user scale
If auto scale checked, program decide the
x-axis and y-axis range. This is good for
initial graph. Let you see trial range.
You can click [user scale] to change to
better range.
<a name="docB005">
Much longer vector 〈v,w〉 and 〈u,w〉 : □shrink, □unchange
Default value is [shrink], for a set of
five v-sequence and five w-sequence length
in the order of 10 for example, the 〈v,w〉
length is in the order of 100. If everything
in scale, the output graph board is most
empty, all input points squeeze to [0,0]
area, only vw and uw two points far away
in the board. Default [shrink] will scale
vw and uw two points to shorter dimension.
<a name="docB006">
In Box23 find
[[
vwuwRatio=maxXY/uw[0]
maxXY=13
uw[0]=203.3405848453525, uw[1]=-2.1316282072803005e-14
vwuwRatio=0.06393214620626249
]]
vw, uw two points are scaled by vwuwRatio
If you select [unchange] and if x/y axis
range is not enough to cover vw, uw two
points, web page will show up big empty
space.
<a name="docB007">
Point Label:
is not used in this file cauchyce.htm
Point Label: is valid in
http://freeman2.com/tute0014.htm#fig2.5
[Graph title:] box let you decide Graph
title
<a name="docB008">
Box 1 a+i*b
and
Box 2 polar
are output box if you click [random#]
button.
v-seq. polar coordinate goto Box 1
w-seq. polar coordinate goto Box 2
These two boxes are not read (not used)
Above is auxiliary control panel.
<a name="docB009">
Below is main control panel,
input v & w seq. Click [Plot9] to run.
Box21 store V seq. in x+iy form
Box22 store W seq. in x+iy form
Do not input polar form to Box21 and Box22
<a name="docB010">
complex separator: □';' □',' □tab □newline □blank
This selection is important, if made
wrong selection, output error.
If your data separated by ',' or tab
or newline or blank, program change them
to ';'. At last step use
string.split(';')
to build data array. See source code at
[[
inp1=inp1.split(';'); //9811072018
]]
<a name="docB011">
Next is
Box21 [multiply by] [2-3i] save to Box22 for Cauchy equality.
complex number Cauchy inequality is
|〈v,w〉|=〈v,v〉1/2〈w,w〉1/2 ---eqn.AK059
If v-sequence and w-sequence are proportional
then Cauchy inequality become equality
|〈v,w〉|=〈v,v〉1/2〈w,w〉1/2 ---eqn.AK201
<a name="docB012">
If you fill a number in [2-3i] box and
click [multiply by] button, w-sequence
change to v-sequence*(2-3i).
Next click [plot9] button, in Box23 output
first two lines number should be equal.
If not, then program wrong.
<a name="docB013">
Box23 RUN ==> complexCauchyF( )
Box23 has main output.
Most important information is first two lines
vnwn=100.02499687578101,0
uw=46.52956049652737,3.552713678800501e-15
complex Cauchy inequality : |〈v,w〉|≦sqrt(〈v,v〉〈w,w〉)
uw is |〈v,w〉| and vnwn is sqrt(〈v,v〉〈w,w〉)
<a name="docB014">
[help00] My number not draw !
give you several possible no drawing cause.
<a name="docB015">
Next
10^[1 ] ; □+/0 , □+/0/- ; [ ] digits
[random#] fill [ ] numbers; □integer;
Help you build test data. Fill in random
number
<a name="docB016">
10^[1 ] decide random number order of magnitude
□+/0 , □+/0/- control real part range
[ ] digits each number has this many digit
[random#] click button to act,
output to box21 and box22
fill [ ] numbers generate this many numbers
□integer; generate only integer number
Below main control panel is drawing board.
2009-11-09-19-00 stop
<a name="docB017">
2009-11-10-10-02 start
■ Why write cauchyce.htm?
On 2009-11-05-13-44 write
□ Numerical value help understand
example is one element "sequence"
[[
v='1+2i';//define v with a real complex number
w='3-4i';//define w
vw=cdotf(v,w);//vw has length rho, angle theta
pvw=cpolr(vw);//show up rho and theta
.....
]]
<a name="docB018">
During the writing of tute0017.htm, LiuHH
did not suspect one element "sequence" get
Cauchy's inequality or not.
2009-11-06-18-12 upload tute0017.htm to
http://freeman2.com/tute0017.htm
<a name="docB019">
2009-11-06-22-22 confirm tute0017.htm one
element "sequence" example satisfy Cauchy
inequality. Result is puzzle.
v='1+2i';
w='3-4i';
cdotf(v,w) = -5,10
<a name="docB020">
(1+2i)*(3-4i)_j
=
(1+2i)*(3+4i)
=3+4i+6i+8ii
=3+4i+6i-8
=-5+10i
why
Complex number Cauchy inequality is
actually
Complex number Cauchy equality ??
2009-11-06-22-27
<a name="docB021">
2009-11-06-22-30 use symbolic math
calculate one element "sequence"
get
(a+bi)*(c+di)=
ac-bd+i(bc+ad)
(ac-bd)*(ac-bd)+(bc+ad)*(bc+ad)
=
aacc+bbdd-abcd-abcd
+bcbc+adad+abcd+abcd
=
aacc+bbdd
+bcbc+adad
<a name="docB022">
|(a+bi)|^2=aa+bb
|(c+di)|^2=cc+dd
(aa+bb)*(cc+dd)
=
aacc+aadd+bbcc+bbdd
<a name="docB023">
2009-11-06-22-36
Complex number Cauchy inequality is
actually
Complex number Cauchy IDENTITY !!
what is wrong !!??
<a name="docB024">
2009-11-06-22-39
guess, because my example
one sequence has just one element
if
one sequence has two element
then different. Guess.
2009-11-06-22-40
<a name="docB025">
2009-11-07-10-26 create two element code
[[
v1='1+2i';//V-seq. 1st element
v2='2-3i';//V-seq. 2nd element
w1='3-4i';//W-seq. 1st element
w2='5-i'; //W-seq. 2nd element
v12=v1+';'+v2;//build V seq.
w12=w1+';'+w2;//build W seq.
vw=cdotf(v12,w12);//V seq. dot W seq.
pvw=cpolr(vw);//change vw to polar
pv1=cpolr(v1);//change v1 to polar
pv2=cpolr(v2);//change v2 to polar
pu1=pv1;//create U seq. 1st element
pu2=pv2;//create U seq. 2nd element
pu1[1]=pu1[1]-pvw[1];//rotate U element
pu2[1]=pu2[1]-pvw[1];//this is key point
u1=cxryi(pu1);//change polar U to x+iy
u2=cxryi(pu2);//
u12=u1+';'+u2;//build U seq. for cdotf()
uw=cdotf(u12,w12);//real due to rotation
vv=cdotf(v12,v12);//real due to self prod.
ww=cdotf(w12,w12);//real due to self prod.
vn=csqrt(vv);//sqrt of self dot is length
wn=csqrt(ww);//length of W sequence
vnwn=cmulf(vn,wn)//greater than side vn*wn
vnwn//print greater than side value
uw //print less than side value
//this time no surprise, they are inequal
//2009-11-07-10-29
]]
<a name="docB026">
output is inequality
vnwn
30.298514815086232,0
uw
8.544003745317534,1.7763568394002505e-15
now
uw ≦ vnwn
is true
2009-11-07-10-30
<a name="docB027">
2009-11-07-13-52 start in tute0017.htm add
program for sequence complex number Cauchy
inequality with drawing capability.
2009-11-07-17-46 split new code out of
tute0017.htm and create cauchyce.htm
Coding, testing, correction and repeat.
Above is the story
Why write cauchyce.htm
2009-11-10-10-35 stop
<a name="docB028">
2009-11-10-11-01 start
On 2009-11-09-16-03 (time stamp 9811091603)
wrote
Sometime unknown reason. Close/reopen cauchyce.htm may help.
2009-11-10-10-55 found what is wrong.
In one test run, set random number order
of magnitude 10^[-1] to -1, get small
complex number like -0.0908-0.0517i
Auto scale minimum size is xmax=ymax=1
xmin=ymin=-1,
<a name="docB029">
but +1 -1 is too big for
-0.0908-0.0517i then I change to user
scale and set range xmax=ymax=0.12
xmin=ymin=-0.12. After this small data
run, next try bigger data run. order
of magnitude 10^[2] to 2 and
forget click auto scale, it is still
user scale at range xmax=ymax=0.12
xmin=ymin=-0.12.
<a name="docB030">
All complex number
is in order of 100. Can not fit 100
to small range drawing board. Then no
drawing at all. Close/reopen cauchyce.htm
Start from auto scale active condition,
program become normal.
2009-11-10-11-15 stop
2009-11-10-16-25 done spelling check
<a name="docB031">
2009-11-10-18-29 start
Source code time stamp from 98111016 to
98111018 change allow one sequence one
element drawn on board.
2009-11-10-18-30 stop