Example
max.poly.order
2 to 100
polish
checked=yes
power=100 error too big
initial
Above C boxes represent one polynomial, Box 1 below
has a set of test points, they are not necessary roots,
these points, output to Box 2.
Box 1, answer
Box 2, debug, verify
user no need to input, just click and output to box 2
user input to box 1, then click and output to box 2
xryi = x real, y imag; Cartesian expression
complex2.htm
has better c1^c2 : cpowf(c1,c2,nB,nE)
;
<a name="doc01">index
2009-02-28-13-39 start
This file is Complex/real coefficient polynomial
root finding program. Main engine function laguer.c
come from Numerical Recipes Software
On 1997-11-05-05-27 get Numerical-Recipes code
from
ftp://ftp.mecheng.asme.org/pub/C_LANG/C-RECIPE.ZIP
(This URL is not valid now 2009-03-10)
<a name="doc02">
2009-02-24-12-06 start write complex0.htm for
complex addition subtraction multiplication
and division.
2009-02-25-12-15 start write polyroot.htm for
polynomial roots. Use Numerical-Recipes function
laguer(). Change from C language to Javascript.
2009-02-26-11-43 get correct root output.
2009-02-26-19-18 visit nr.com see their rule
2009-02-26-19-41 access
http://www.nr.com/licenses/
2009-02-26-20-02 find ftp.mecheng.asme.org
is not valid any more.
2009-02-27 add function, allow input given
roots and find polynomial coef.
2009-02-28 add more function, for example
"test number to complex".
Most application, solve real coef. polynomial.
Because complex number cover real number.
So this program solve real coef. polynomial
too. Fill one number (real number) in coef.
boxes C00, C01, C02 .....
2009-02-28-13-52 stop
<a name="doc03">index
2009-02-28-16-26 start
This file has following five functions.
First: find root for Complex/real coefficient
polynomial.
Second: Allow evaluate test points function
value.
Third: Given roots find coef.
Fourth: test different number expression how
it convert to complex two element array.
Fifth: test complex manipulation functions.
<a name="doc04">
Document as below.
First: find root for Complex/real coefficient
polynomial.
This is this file's main function
Step 1: in "max.poly.order [ ] 2 to 100" fill
a number in [ ]. For example '3'. Then
program auto generate four coef. boxes.
nth order polynomial need n+1 coef.
because there is an extra constant term.
<a name="doc05">
Step 2: In coef. C boxes fill polynomial coef.
If solve a real coef. polynomial, each
box need one real number. If it is complex
polynomial, fill in a complex number.
for example '1+2i', you can use '1+2i'
or '2i+1' or '1,2'. They are the same.
In most case, highest order term coef.
has real value '1+0i' [laguer() allow
non-'1+0i' highest order term coef.]
<a name="doc06">
Step 3: click [fast get root, verify answer]
OR
click [slower root, debug output]
solution write to "Box 1, answer"
aux. save to "Box 2, debug, verify"
[fast get root, verify answer] evaluate
polynomial value at root point. Exact
answer is zero. If value fall in between
-1.e-7 and +1.e-7 this root is OK.
[slower root, debug output] display
debug information. If polynomial order
exceed 20. debug output is time consuming.
Main reason is output too long. Computer
busy find storage space for long string.
9802281658 here
<a name="doc07">
Second: Allow evaluate test points function
value.
When find a root, if it has poor
evaluation. You can try neighbor
points and evaluate their values.
Put test points in box 1,
Find next three lines above box 1
Above C boxes represent one polynomial, Box 1 below
has a set of test points, they are not necessary roots,
[evaluate] these points, output to Box 2.
click [evaluate] button. Find answer
in box 2.
9802281704 stop
<a name="doc08">
9802281837 start
When use above Second function, user must
fill in all polynomial coef. boxes,
(polynomial defined) then it is possible
to evaluate points.
Third: Given roots find coef.
Assume there are three given roots.
click '03' right to '2 to 100'
then fill three roots in box 1, one line
one root. Click "given root find coef."
given root in box 1 disappear
9802281847 stop 9802282025 start
replace with polynomial coef. which has
given roots as its solution. Box 2 has
both given roots value and coef.
Coef. in box 1 can be transferred to
C coef. small boxes. Now click
"Box 1 is coef. fill to small box"
Program auto fill coef. for you.
Click "fast get root verify answer"
if everything smooth, you should get
the given roots as new solution.
9802282036 here
<a name="doc09">
Fourth: test different number expression how
it convert to complex two element array.
Below "Box 2, debug, verify" please find
click button "test number to complex"
user no need to input, just click and output to box 2
click button "my number to complex"
user input to box 1, then click and output to box 2
If click "test number to complex",
program fill test string to box 1 and
run toCplx() convert string to complex.
If click "my number to complex",
program NOT fill test string to box 1
allow user to fill his own test string
to box 1. (fill string first then click
"my number to complex")
<a name="doc10">
Fifth: test complex manipulation functions.
goto the line marked
"complex1 complex2 output function name"
here one line one function. Total thirteen
functions. Each line has three boxes.
Most function use left and middle boxes
for input arguments. Output to right box.
This is for programmer test functions.
9802282046 stop
<a name="doc11">
2009-03-10-17-27 translation stop
2009-03-10-18-30 translation start
9802282219 start
2009-02-28-22-19 start
Below explain three points.
<a name="doc12">index
First.
Program use iteration method to find roots.
Initial point is 0+0i, if find answer
[[
1st root -0.9988389295286827,0.33966125914902345
evaluation is -0.007944743411053112,0.008009045986170804
Absolute value is 0.011281124300178174 should be zero.
]]
Absolute value is 0.011281124300178174 not good.
<a name="doc13">
To improve, substitute 1st root
-0.9988389295286827,0.33966125914902345
into initial point box, run second time get
[[
1st root -0.9988389707116815,0.3396529909955216
evaluation is -1.7822854303517488e-11,4.598099678787548e-12
Absolute value is 1.840642975105379e-11 should be zero.
]]
Absolute value is 1.840642975105379e-11 much better.
This is initial value box usage.
<a name="doc14">index
Second.
fill [random number] let user test program
and no need to input specific coef.
Third.
polish [ ] checked=yes
If box is checked, program will run few more
iteration to improve answer.
9802282227 stop
<a name="doc15">
9803011025
Fill in coef. numbers one by one? too much work.
Put all coef. in box 1. Line 1 is constant term,
line 2 is coef. for first order, etc. then click
"Box 1 is coef. fill to small box" Program auto
fill to small C boxes.
9803011028
<a name="doc16">index
9803011202
About "complex pow" button. cpowf(c1,r1) function
(above 'r1' mean real number power 9803020925)
Reader can do next experimental work
Run 1.1+1.2i to power 0.3333333333333
that is to take cubic root for 1.1+1.2i
Answer is
1.1317496330101923,0.3208898125926623
Paste answer number to left box (right to
"complex pow" button) change middle box from
0.33333333333333 to 3
Click "complex pow" button (reverse of cubic
root)
Answer is
1.1000000000000003,1.1999999999999997
this is original 1.1+1.2i
This verify process, show that "complex pow"
function correct. But not guarantee other
number also get correct answer.
If "complex pow" use power 0.5 that is same as
square root.
9803011210
<a name="doc17">
"xryi" in "xryi to polar" means Cartesian
expression like 1.1+1.2i
"polar" in "xryi to polar" means polar expression
Use complex number absolute value and complex
number angular value.
For example, "1.1+1.2i" express in polar form is
1.6278820596099707,0.8288490587889791
where
1.6278820596099707 is absolute value of 1.1+1.2i
0.8288490587889791 is angular value of 1.1+1.2i
absolute value of a+bi is sqrt(a*a+b*b)
angular value of a+bi is atan2(b,a)
9803011217
<a name="doc18">index
Polynomial of order 100 has too big error!
Correct evaluation for a root is zero, but
polynomial of order 100 error variation is
wide. Below is three experimental work.
All fill random number to coef. boxes.
1st root -27.17957626448283,1.9752765245766852
evaluation is 1.4449038238060076e+144,2.189848792957901e+143
Absolute value is 1.4614039268489098e+144 should be zero.
1st root -1.1807950170562482,0.31480027636011354
evaluation is -24.248959138920753,3.6002667849790333
Absolute value is 24.514769838692583 should be zero.
1st root -1.187684780721903,-0.3148747224749606
evaluation is -0.000011195001952124528,0.000001952277281391801
Absolute value is 0.000011363954210199483 should be zero.
<a name="doc19">
If click "fast get root, verify answer" run
polynomial of order 100, need about 10 to 20
seconds, depend on computer CPU speed.
If click "slower root, debug output" run
polynomial of order 100, need about one
hour. Because output is too long.
9803011233
<a name="doc20">index
2009-03-02-09-30 start
2009-03-01-15-07 first time upload Chinese
version Complex/real coefficient polynomial
root finding polyroo1.htm into Internet.
URL is
http://freeman2.com/polyroo1.htm
This version "complex pow" limit to complex
rise to arbitrary REAL power
After upload, think again, why not write a
program which work for complex rise
to arbitrary COMPLEX power?
[[
2009-03-01-22-09 I wrote cpowf(c1,r1) is not
complete, a complete "complex pow" function
allow complex^complex
.....
//9803020922 complex^complex success !!
]]
After few hour work, get correct
complex^complex function. But still as
usual, no one proofread my work, this
self-guess-right work may be actually
wrong.
The derivation for complex^complex is in
this page source code comment section.
Please open this file source code find
"2009-03-01-22-09 the function I wrote"
2009-03-02-09-41 stop
<a name="doc21">
2009-03-02-11-18 start
2009-03-02-10-23 second time upload polyroo1.htm
2009-03-02-10-49 found polyroo1.htm has solution
i^i = 1+0i !! WRONG !! correct answer is
i^i = exp(-PI/2)
i^i = 0.20787957635076193+0i
2009-03-02-11-13 delete error "if() return"
2009-03-02-11-22 stop
2009-03-10-19-23 translation stop
<a name="doc22">
2009-03-13-17-24 start
Numerical-Recipes use 0+0i as initial value
as following
[[
x=Complex(0.0,0.0);
laguer(ad,j,&x,EPS,0);
]]
When freeman write code, follow Numerical-Recipes
method use 0+0i as initial value.
Test run, solve
x^6-1=0
the whole equation is
x^6 +0*x^5 +0*x^4 +0*x^3 +0*x^2 +0*x^1 -1=0
There are five zero coef. today find
[[
2009-03-13-17-11
when solve x^6-1=0
do not use 0+0i as initial value, which cause
divide by zero.
Use 1+1i as initial value instead, program run
without trouble.
]]
use 0+0i cause trouble, change to 1+1i as
default initial value, then no error.
2009-03-13-17-33 stop
<a name="doc23">
2009-03-14-05-01 start
[[
2009-03-14-04-40 real number polynomial use
complex initial point, if this cause trouble?
test run, conclude no trouble.
initial value 0+1i
example 05 root 2 repeat ten times, program solve it. 9802261806
answer is correct, no imaginary invade answer.
]]
2009-03-14-04-42 add help information
run "slower root, debug output"
box 2 output was
coefficient is -960,0
2009-03-14-04-42 add 'x^7 ' change to
x^7 coefficient is -960,0
2009-03-14-04-59 stop
2009-03-14-05-07 computer monitor big blink,
scary blink !! monitor is about stop service.
This is the only working monitor I have.
<a name="doc24">
2009-03-24-21-19 start
please view page source find
9803241937 use parseFloat() avoid error
use parseFloat(). return number, otherwise
return string.
2009-03-24-21-21 stop
<a name="200903101925">index
2009-03-10-19-25 this page is
http://freeman2.com/polyroot.htm
it is English polyroot program
polyroot.htm contain two Chinese web pages
Above this point, it has Chinese equivalent
http://freeman2.com/polyroo1.htm
change page [=][][]
Below this point, it has Chinese equivalent
http://freeman2.com/tutc0006.htm
2009-03-10-19-30
problem 1 find x in x^i = i -----(A00)
problem 2 find x in i^x = x -----(B02)
<a name="prob0a01">index
2009-03-05-11-22 start translate math problem.
No one proofread Freeman's work. All proof in
this page may contain error. If you suspect
anything wrong, please ask a math expert near
by. Please put more question when you read
this file. 2009-03-04-16-04.
The following is to solve a small math problem
given: i=sqrt(-1)
in equation
x^i = i -----(A00)
find x
2009-03-04-11-03 start
When write Complex/real coefficient polynomial
root finding program
http://freeman2.com/polyroot.htm
Chinese version is uploaded on 2009-03-01
http://freeman2.com/polyroo1.htm
need find the answer of arbitrary complex base
arbitrary complex power. That is to find
(a+b*i)^(p+q*i)=?=(m+n*i)
After get general equation, assign
p=m=0 and q=n=1 then solve for a, b
get solution of problem (A00).
First find general equation, start from
(a+b*i)^(p+q*i)
(2009-03-05-11-36 here)
<a name="prob0a02">
on 2009-03-02-08-29 begin the following
calculation.
(a+b*i)^(p+q*i)
=(c*exp(i*d))^(p+q*i) ----(A01)
={[c*exp(i*d)]^p}*[c*exp(i*d))]^(q*i) ----(A02)
={[(c^p)*exp(i*p*d)]} ----(A03)
*{[c^(q*i)]*exp(i*d*q*i)}
={(c^p)*[cos(p*d)+i*sin(p*d)]} ----(A04)
*{[c^(q*i)]*exp(i*i*d*q)}
<a name="prob0a03">
Let ww={(c^p)*[cos(p*d)+i*sin(p*d)]} ----(A05)
=ww
*{[c^(q*i)]}*exp(-d*q) ----(A06)
=ww
*{[(c^q)^i]}*exp(-d*q) ----(A07)
=ww
*{exp[log((c^q)^i)]}*exp(-d*q) ----(A08)
=ww
*{exp[i*log(c^q)]}*exp(-d*q) ----(A09)
<a name="prob0a04">
=ww ----(A10)
*{cos(log(c^q))+i*sin(log(c^q))}*exp(-d*q)
={(c^p)*[cos(p*d)+i*sin(p*d)]}
*{cos(log(c^q))+i*sin(log(c^q))}
*exp(-d*q) ----(A11)
={(c^p)*exp(-d*q)}
*[cos(p*d)+i*sin(p*d)]
*{cos(log(c^q))+i*sin(log(c^q))} ----(A12)
={(c^p)*exp(-d*q)} ----(A13)
*{cos[p*d+log(c^q)]+i*sin[p*d+log(c^q)]}
2009-03-02-08-51 if this result right?
<a name="prob0a05">
Explain step by step as following
Proof use Euler's formula
exp(i*t)=cos(t)+i*sin(t) ----(A91)
(Euler's formula can be found in many
math text books, for example
Calculus and Analytic Geometry 6th ed.
George B. Thomas, Jr. and Ross L. Finney
ISBN 0-201-16290-3
Page 668 has proof, use Taylor series
Maclaurin series
)
<a name="prob0a06">
Euler's formula is a very important
equation, Euler's formula link Cartesian
expression of complex number cos(t)+i*sin(t)
with polar expression of complex number
exp(i*t)
Euler's formula work for complex number
length equal to one. For non-unit length
arbitrary complex number, convert as following
Assume arbitrary complex number (a+b*i) length
is L where L=sqrt(a*a+b*b), calculate as below
(a+b*i) = (a+b*i)*1 = (a+b*i)*L/L
(a+b*i) = L*(a+b*i)/L = L*((a/L) +(b/L)*i)
here (a/L) +(b/L)*i is a length-one complex
number, Euler's formula apply correctly.
Starting point is
(a+b*i)^(p+q*i)
=(c*exp(i*d))^(p+q*i) ----(A01)
here change base (a+b*i) to polar expression
(c*exp(i*d)) Two expression are equivalent.
The power complex (p+q*i) keep as Cartesian
expression of complex number cos(t)+i*sin(t)
not change to polar expression. Because
Cartesian expression is easier to work as
power factor. here 'c' in (c*exp(i*d)) is
length L mentioned earlier.
<a name="prob0a07">
Next is step two
=(c*exp(i*d))^(p+q*i) ----(A01)
={[c*exp(i*d)]^p}*[c*exp(i*d))]^(q*i) ----(A02)
power factor (p+q*i) separate as real and
imaginary. Base complex not change.
step three
={[(c^p)*exp(i*p*d)]} ----(A03)
*{[c^(q*i)]*exp(i*d*q*i)}
change from "^(q*i)" to "*q*i" use following
equation
(m^n)^o = m^(n*o) ----(A92)
<a name="prob0a08">
equation (A92) can be explained as following
(2009-03-05-11-57 here)
[[
2009-03-01-22-42
2^3=8
(2^3)^2=8*8=64
on the other hand
(2^3)^2=2^(3*2)=2^6=4^3=64
]]
<a name="prob0a09">
step four
={[(c^p)*exp(i*p*d)]} ----(A03)
*{[c^(q*i)]*exp(i*d*q*i)}
={(c^p)*[cos(p*d)+i*sin(p*d)]} ----(A04)
*{[c^(q*i)]*exp(i*i*d*q)}
apply Euler's formula to multiplier-one
[(c^p)*exp(i*p*d)]
to get
(c^p)*[cos(p*d)+i*sin(p*d)]
multiplier-two [c^(q*i)]*exp(i*d*q*i)
put two 'i' together.
<a name="prob0a10">
step five, let multiplier-one to be
ww={(c^p)*[cos(p*d)+i*sin(p*d)]} ----(A05)
to simplify the following calculation.
step six, use simplified multiplier-one ww
and in multiplier-two i*i = -1
=ww
*{[c^(q*i)]}*exp(-d*q) ----(A06)
<a name="prob0a11">
step seven use (A92) put i to power location
so that step 10 can use Euler's formula.
=ww
*{[(c^q)^i]}*exp(-d*q) ----(A07)
Euler's formula is
exp(i*t)=cos(t)+i*sin(t) ----(A91)
but equation (A07) has [(c^q)^i] and
no exp() function, need to put
[(c^q)^i] into exp() . We know that
exp() and log() are two reverse function
in other words
exp(log(Y))=Y ----(A93)
[(c^q)^i] in equation (A07) not reside
inside of exp() ?!
Easy !
<a name="prob0a12">
step eight
=ww
*{exp[log((c^q)^i)]}*exp(-d*q) ----(A08)
use equation (A93) put [(c^q)^i] into exp()
but
Euler's formula is
exp(i*t)=cos(t)+i*sin(t) ----(A91)
need complex i multiply with a function,
but equation (A08) is
exp[log((c^q)^i)]
in (c^q)^i complex i reside at power location
not a multiplier location, we are lucky, here
is log function
log((c^q)^i)
change to
i*log(c^q)
to put complex i to a multiplier location.
<a name="prob0a13">
move complex i is step nine
=ww
*{exp[i*log(c^q)]}*exp(-d*q) ----(A09)
upto here, [c^(q*i)] in step six change to
exp[i*log(c^q)]
step ten, apply Euler's formula get
=ww ----(A10)
*{cos(log(c^q))+i*sin(log(c^q))}*exp(-d*q)
<a name="prob0a14">
step eleven, recover ww in step five
={(c^p)*[cos(p*d)+i*sin(p*d)]}
*{cos(log(c^q))+i*sin(log(c^q))}
*exp(-d*q) ----(A11)
step twelve, arrangement
={(c^p)*exp(-d*q)}
*[cos(p*d)+i*sin(p*d)]
*{cos(log(c^q))+i*sin(log(c^q))} ----(A12)
[hint: cos(p*d) * cos(log(c^q))
add angle, get cos[p*d+log(c^q)]
Complex number multiplication in polar
expression, add two phase angles.
Similar reason for sin(). 9803111111 ]
<a name="prob0a15">index
step thirteen, //left hand side, starting point
(a+b*i)^(p+q*i)=(c*exp(i*d))^(p+q*i)
final general equation is //right hand side [9803131121 add]
={(c^p)*exp(-d*q)} ----(A13)
*{ cos[p*d+log(c^q)]
+i*sin[p*d+log(c^q)]
}
2009-03-02-08-51 if this result right? (right)
<a name="add2npi1">index
2009-03-14-09-58 start
Because answer is expressed with triangular
functions, and triangular functions are
periodic function, add or subtract any
integer number of period, 2*PI, 4*PI,
2*n*PI not change function value.
Then, when n is an integer, for any angle x
the following relation is true
cos(x)=cos(x+2*n*PI)
sin(x)=sin(x+2*n*PI)
answer is expressed with triangular functions
that answer has infinite many.
after take 2*n*PI into consideration, final
answer is
(a+b*i)^(p+q*i)=(c*exp(i*d))^(p+q*i)
={(c^p)*exp(-d*q)} ----(A13add2npi)
*{ cos[p*d+log(c^q)+2*n*PI]
+i*sin[p*d+log(c^q)+2*n*PI]
} where n is arbitrary integer.
2009-03-14-10-04 stop
<a name="add2npi2">
2009-03-15-23-51 start
Above mentioned +2*n*PI no help.
2*n*PI add to phase angle p*d+log(c^q) if
in solution phase angle is used in triangular
function, then add 2*n*PI not change answer.
for example
exp(ix)=cos(x)+i*sin(x)
compare with
exp(i(x+2*n*PI)) = cos(x+2*n*PI)
+i*sin(x+2*n*PI)
Equation left hand side is multiple-input
(different n value) get one answer
[ cos(x+2*n*PI) and cos(x) are same ]
then, 2*n*PI no need to enter solution.
<a name="add2npi3">index
On the other hand, if in solution phase angle
is used in NON-triangular function, then add
2*n*PI DO change answer.
for example
log(z) = log(abs(z)) + i*(arg(z)+2*n*PI)
here different n in 2*n*PI generate diferent
answer. We can not ignore 2*n*PI .
It has been long time not study complex variable.
Recent few day paid attention to complex number.
Start point is using function laguer(). Today
2009-03-15 when write complex function program
paid attention to one-to-many and many-to-one
functions using 2*n*PI in answer are different.
This file is personal home work. Output may
contain error. Please verify first.
Mentioned concept may be incorrect, please
put more question
2009-03-16-00-18 stop
<a name="prob0a16">
equation (A13) is a general equation, after
assign parameter value, it is easy to solve
problem
given
x^i = i
find x
below is another work record.
2009-03-05-12-15 record here
<a name="prob0a17">
2009-03-03-22-22
x^i=i
find x
answer x=exp(pi/2)
[[
2009-03-02-09-06 final equation is
(a+b*i)^(p+q*i)
=(c*exp(i*d))^(p+q*i)
={(c^p)*exp(-d*q)} ----(A13)
*{cos[p*d+log(c^q)]+i*sin[p*d+log(c^q)]}
]]
<a name="prob0a18">index
problem is
x^i=i -----(A00)
left hand side x^i
is a special case of general equation
(c*exp(i*d))^(p+q*i)
now assign
p=0, q=1 -----(A21)
then left hand side become
(c*exp(i*d))^(0+1*i)
that is
(c*exp(i*d))^(i) -----(A22)
satisfy problem power factor is just an 'i'
c and d in (A22) is unknown to be found.
<a name="prob0a19">
general equation right hand side is
={(c^p)*exp(-d*q)} ----(A13)
*{cos[p*d+log(c^q)]+i*sin[p*d+log(c^q)]}
problem (A00) right hand side is
i -----(A23)
use (A21) re-write (A23) as below
right hand side = i = 1*(0+1*i) -----(A24)
<a name="prob0a20">
compare (A13) with (A24) must have the
following relation
(c^p)*exp(-d*q)=1 -----(A25)
p*d+log(c^q)=PI/2 -----(A26)
[ hint: cos(PI/2)=0, sin(PI/2)=1 ]
substitute (A21) into (A25) get
(c^0)*exp(-d*1)=1 -----(A27)
substitute (A21) into (A26) get
0*d+log(c^1)=PI/2 -----(A28)
<a name="prob0a21">
from (A27) get
1*exp(-d*1)=1 ==> -d=0 (e^0=1) -----(A29)
from (A28) and (A29) get
0*d+log(c^1)=PI/2 ==> c=exp(PI/2) -----(A30)
final result is
c=exp(PI/2)
d=0
substitute c and d into (a+b*i)=c*exp(i*d)
get
(a+b*i)=c*exp(i*d)=exp(PI/2)*exp(i*0)
(a+b*i)=exp(PI/2)*1
(a+b*i)=exp(PI/2)
<a name="prob0a22">index
problem
x^i = i
find x
correct solution is
x=exp(PI/2)=4.810477380965351
2009-03-03-22-41 correct
<a name="prob0a23">
please goto
http://freeman2.com/polyroo1.htm#testFunc
above is already uploaded Chinese page
please goto
http://freeman2.com/polyroot.htm#testFunc
This page you are reading
AFTER TRANSLATION IS DONE
find key string "a name=testFunc"
Last line of this table is
"arbitrary power [ ] [ ] [ ] cpowf(c1,c2)
in left box fill 4.810477380965351
in middle box fill i
click left button
(At writing time only Chinese version
uploaded, you can locate correctly by
find "cpowf(c1,c2)", same line left
end has a execute button.)
click left button, output at right box
its value is
6.123031769111886e-17,1
that is
0,1
that is
0+i
program result confirm answer is right
2009-03-05-12-30 here
<a name="20090305a">
2009-03-05-12-32 start
2009-03-01 uploaded Chinese version polyroo1.htm
cpowf(c1,c2) in that version
accept only complex^real number.
not accept complex^complex number.
2009-03-02 I try to figure out complex^complex
equation, and re-write polyroo1.htm
2009-03-03 I goto UCLA for dental care.
<a name="20090305b">
2009-03-04 write Chinese version of
x^i = i -----(A00)
find x
uploaded to
http://freeman2.com/tutc0006.htm
today 2009-03-05 write English version of
x^i = i -----(A00)
find x
will upload to
http://freeman2.com/polyroot.htm<a name="20090305c">
in other word, I still not start translate
polyroot.htm at present time.
<a name="prob0b01">
2009-03-06-10-50 start
Above is problem 1
given i = sqrt(-1)
find x in
x^i = i
Analytic solution is
x=exp(PI/2)=4.810477380965351
<a name="prob0b02">index
Below is problem 2
exchange role in problem 1 for i and x
that is
problem 2
given i = sqrt(-1) -----(B01)
find x in
i^x = x -----(B02)
numerical solution is
x=(p+q*i)= -----(B03)
(0.4382829367270321+0.36059247187138543*i)
this specific complex number (p+q*i) has
the following relation
i^(p+q*i)=(p+q*i) -----(B04)
<a name="prob0b03">
Explain as below.
[[
final general equation is
(a+b*i)^(p+q*i)
=(c*exp(i*d))^(p+q*i)
={(c^p)*exp(-d*q)} ----(A13)
*{cos[p*d+log(c^q)]+i*sin[p*d+log(c^q)]}
]]
2009-03-05-15-16 (this is calculation time)
2009-03-06-10-57 (this is recording time)
how to solve i^x=x ?
<a name="prob0b04">
base is i then
(a+b*i)=0+i -----(B05)
Above is base complex express in Cartesian
coordinate system.
Below is base complex express in Polar
coordinate system.
c*exp(i*d)= -----(B06)
1*exp(i*1.5707963267948965)
=1*exp(i*PI/2)
<a name="prob0b05">
Base complex require to be i and
i = c*exp(i*d)= 1*exp(i*PI/2) -----(B07)
then must have
c=1 -----(B08)
d=PI/2 -----(B09)
<a name="prob0b06">
Above is i in i^x=x
Below is x in i^x=x
x locate in power index x left side of '='
and x locate at right side of '='
power index x is (p+q*i) -----(B10)
based on general equation (A13),
right side x is
{(c^p)*exp(-d*q)} -----(B11)
*{cos[p*d+log(c^q)]+i*sin[p*d+log(c^q)]}
<a name="prob0b07">
This problem i^x=x has special requirement
that is
power index x left side of '=', (p+q*i)
and right hand side x =
{(c^p)*exp(-d*q)}
*{cos[p*d+log(c^q)]+i*sin[p*d+log(c^q)]}
both are same number x.
<a name="prob0b08">
Next relation must be true
(again, special to the current problem)
(p+q*i)= -----(B12)
{(c^p)*exp(-d*q)}
*{cos[p*d+log(c^q)]+i*sin[p*d+log(c^q)]}
<a name="prob0b09">
Let real at left equal to real at right,
Let imag at left equal to imag at right,
get following relations
p=(c^p)*exp(-d*q)*cos[p*d+log(c^q)] -----(B13)
q=(c^p)*exp(-d*q)*sin[p*d+log(c^q)] -----(B14)
p and q twist together.
2009-03-05-15-20 calculate here
2009-03-06-11-09 record here
<a name="prob0b10">
substitute
c=1 -----(B08)
d=PI/2 -----(B09)
into (B13) and (B14) get
p=(1^p)*exp(-q*PI/2)*cos[p*PI/2+log(1^q)]
q=(1^p)*exp(-q*PI/2)*sin[p*PI/2+log(1^q)]
simplify
p=1*exp(-q*PI/2)*cos[p*PI/2+0]
q=1*exp(-q*PI/2)*sin[p*PI/2+0]
<a name="prob0b11">
simplify again
p=exp(-q*PI/2)*cos[p*PI/2] -----(B15)
q=exp(-q*PI/2)*sin[p*PI/2] -----(B16)
how to find p ? how to find q ?
sum of squares eliminate sin, cos
p*p=exp(-q*PI/2)*exp(-q*PI/2)*cos[p*PI/2]*cos[p*PI/2]
q*q=exp(-q*PI/2)*exp(-q*PI/2)*sin[p*PI/2]*sin[p*PI/2]
<a name="prob0b12">
p*p+q*q=exp(-q*PI/2)*exp(-q*PI/2) -----(B17)
2009-03-05-15-25 does that help?
look like exp(-q*PI/2) relate to length
of (p+q*i)
exp(-q*PI/2)=abs(p+q*i) -----(B18)
p=abs(p+q*i)*cos[p*PI/2] -----(B19)
q=abs(p+q*i)*sin[p*PI/2] -----(B20)
2009-03-05-15-30
<a name="prob0b13">index
2009-03-05-15-50 equation is correct up to
p=exp(-q*PI/2)*cos[p*PI/2] -----(B15)
q=exp(-q*PI/2)*sin[p*PI/2] -----(B16)
in exp() and sin() both contain p*PI/2
let equation left hand side also contain p*PI/2
whole equation multiply by p*PI/2 get
p*PI/2=exp(-q*PI/2)*cos[p*PI/2]*PI/2 -----(B21)
q*PI/2=exp(-q*PI/2)*sin[p*PI/2]*PI/2 -----(B22)
<a name="prob0b14">
2009-03-05-15-54 here
let p*PI/2=m -----(B23)
let q*PI/2=n -----(B24)
then (B21) and (B22) become
m=exp(-n)*cos(m)*PI/2 -----(B25)
n=exp(-n)*sin(m)*PI/2 -----(B26)
<a name="prob0b15">
(B25)/(B26) get
m/n=cos(m)/sin(m) -----(B27)
(B25) and (B26) square sum get
m*m+n*n=exp(-n)*exp(-n)*(PI*PI/2/2) -----(B28)
from (B27) find n
n=m*sin(m)/cos(m) -----(B29)
<a name="prob0b16">
substitute n into (B28)
m*m+[m*sin(m)/cos(m)]*[m*sin(m)/cos(m)]
=exp(-m*sin(m)/cos(m))*exp(-m*sin(m)/cos(m))
*(PI*PI/2/2) -----(B30)
upto here (B30) whole equation has just one
variable m
let (B30) become
f(m)=m*m+(m*sin(m)/cos(m))*(m*sin(m)/cos(m))
-exp(-m*sin(m)/cos(m))*exp(-m*sin(m)/cos(m))*(PI*PI/2/2)
<a name="prob0b17">
Below use numerical method to find solution
2009-03-05-16-02 change m to t
because graph page
http://freeman2.com/graph09e.htm
require variable to be 't' (not 'm')
<a name="prob0b18">index
f(t)=
t*t+(t*sin(t)/cos(t))*(t*sin(t)/cos(t))-exp(-t*sin(t)/cos(t))*exp(-t*sin(t)/cos(t))*(PI*PI/2/2)
after graph, estimate
m=t=0.7 close to one solution
let p*PI/2=m
p=m*2/PI=0.7*2/PI=0.44563384065730693
<a name="prob0b19">
goto page
http://freeman2.com/graph09e.htm
click "modify 601" button
click "all" in "Del function 1 2 3 4 5 all"
in function 1 x(t) fill 't'
in function 1 y(t) fill next line
t*t+(t*sin(t)/cos(t))*(t*sin(t)/cos(t))-exp(-t*sin(t)/cos(t))*exp(-t*sin(t)/cos(t))*(PI*PI/2/2)
then click "draw" at left yellow line top end.
(Can not click "draw 601" button.)
graph show up,
m=t=.7 close to one solution
<a name="prob0b20">
let q*PI/2=n
m=0.7
n=m*sin(m)/cos(m)
q=n*2/PI
q=0.375352205926785
<a name="prob0b21">
use for() loop to find better solution.
tool is "Small calculator" in
http://freeman2.com/eyefoot2.htm
2009-03-05-16-13 use next commands
[[
var oStr='';
var aa=0;
var t=0;
for(t=0.688453;t<0.688456;t=t+0.0000001){aa=t*t+(t*sin(t)/cos(t))*(t*sin(t)/cos(t))-exp(-t*sin(t)/cos(t))*exp(-t*sin(t)/cos(t))*(PI*PI/2/2);oStr+=t+', '+aa+'\n';}
oStr
]]
paste above five lines in Box 3 of eyefoot2.htm
click "click here click here" button
output at box4
<a name="prob0b22">
t=0.6884532999999998
t*t+(t*sin(t)/cos(t))*(t*sin(t)/cos(t))-exp(-t*sin(t)/cos(t))*exp(-t*sin(t)/cos(t))*(PI*PI/2/2)
= 4.927305469193399e-7
<a name="prob0b23">
2009-03-05-16-25
m=t=0.68845322722
t*t+(t*sin(t)/cos(t))*(t*sin(t)/cos(t))-exp(-t*sin(t)/cos(t))*exp(-t*sin(t)/cos(t))*(PI*PI/2/2)
= 7.59100893255038e-10
<a name="prob0b24">
let p*PI/2=m
let q*PI/2=n
2009-03-05-16-27
m=0.68845322722
n=m*sin(m)/cos(m)
q=n*2/PI
q= 0.3605924720127381
p=m*2/PI
p= 0.4382829367985232
<a name="prob0b25">
p+qi=
0.4382829367985232+0.3605924720127381i
2009-03-05-16-30 get numerical solution for
i^x=x
Here x is (p+qi)
i^(p+qi)
i^[0.4382829367985232+0.3605924720127381i]
equal to
0.43828293658922373,0.3605924718405392
2009-03-05-16-31
<a name="prob0b26">
what is analytic solution for i^x=x ??
[[
p=abs(p+q*i)*cos[p*PI/2]
q=abs(p+q*i)*sin[p*PI/2]
p*PI/2=exp(-q*PI/2)*cos[p*PI/2]*PI/2
q*PI/2=exp(-q*PI/2)*sin[p*PI/2]*PI/2
98,03,05,15,54
let p*PI/2=m
let q*PI/2=n
m=exp(-n)*cos(m)*PI/2
n=exp(-n)*sin(m)*PI/2
]]
<a name="prob0b27">
look like it is possible to find analytic
solution for i^x=x
2009-03-05-16-33
sqrt(p*p+q*q)
= 0.5675551634519729
solution x length is not one.
2009-03-05-16-59
Analytic solution is real solution,
numerical solution is just side proof.
<a name="prob0b28">
2009-03-05-17-05
sqrt(p*p+q*q) = exp(-q*PI/2)
(p*p+q*q) = [exp(-q*PI/2)]^2
(p*p+q*q) = exp[(-q*PI/2)*2]
(p*p+q*q) = exp(-q*PI)
<a name="prob0b29">
2009-03-05-17-07
atan2(q,p) = p*PI/2
2009-03-05-17-12 or work with m, n
[[
let p*PI/2=m
let q*PI/2=n
m=exp(-n)*cos(m)*PI/2
n=exp(-n)*sin(m)*PI/2
2009-03-05-15-55
m/n=cos(m)/sin(m)
m*m+n*n=exp(-n)*exp(-n)*(PI*PI/2/2)
n=m*sin(m)/cos(m)
]]
<a name="prob0b30">index
2009-03-05-18-05
m=t=0.6884532271077
t*t+(t*sin(t)/cos(t))*(t*sin(t)/cos(t))-exp(-t*sin(t)/cos(t))*exp(-t*sin(t)/cos(t))*(PI*PI/2/2)
= -1.4988010832439613e-14
t=0.688453227107703
= 5.218048215738236e-15
t=0.688453227107702105
= -3.3306690738754696e-16
2009-03-05-18-08 found minimum error
numerical answer
m=t=0.688453227107702105
function value = -3.3306690738754696e-16
<a name="prob0b31">
2009-03-05-18-10
m,n is intermediate variable
p,q is a complex number in problem
i^(p+q*i)=(p+q*i)
m=0.688453227107702105
n=m*sin(m)/cos(m)
q=n*2/PI
p=m*2/PI
p
= 0.4382829367270321
q
= 0.36059247187138543
i^(p+q*i)=(p+q*i)
<a name="prob0b32">
2009-03-05-18-12
put
i^(0.4382829367270321+0.36059247187138543*i)
=(p+q*i)
into
http://freeman2.com/polyroo1.htm#testFunc
above is Chinese page, uploaded on 2009-03-01
English page is the current page now you
are reading.
http://freeman2.com/polyroot.htm#testFunc
At writing time 2009-03-06-11-46
translation for polyroot part NOT begin yet.
<a name="prob0b33">index
in polyroo1.htm, goto
"arbitrary power [ ] [ ] [ ] cpowf(c1,c2)"
in left box fill i
in middle box fill next line
0.4382829367270321+0.36059247187138543*i
click left button, output to right box
output 0.4382829367270322,0.3605924718713855
input 0.4382829367270321+0.36059247187138543*i
output is p,q complex right to '=' in i^(p+q*i)=(p+q*i)
input is p,q complex left to '=' in i^(p+q*i)=(p+q*i)
After compare in/output, the answer
x = 0.4382829367270321+0.36059247187138543*i
is correct.
2009-03-05-20-04 Chinese doc here
2009-03-06-11-52 English doc here
<a name="prob0b34">
Problem 2
i^x=x
Freeman can find only numerical solution.
Analytic solution is real solution,
numerical solution is just side proof.
Freeman ask math expert:
if problem 2 has an analytic solution?
Freeman 2009-03-06-11-56
<a name="9803062032">index
2009-03-11-11-37 translation start
2009-03-06-20-32 document start
After solve problem one
x^i = i
like to see this equation
(c*exp(i*d))^(p+q*i) ----(A01)
draw what kind curve?
Curve allow only one independent variable.
Equation (A01) has four parameters c,d,p,q
It is possible to assign one of four as
independent variable. It is also possible
assign the following relation
c=c(t)
d=d(t)
p=p(t)
q=q(t)
allow two or more parameters vary at same
time. But there is no reason (theory) for
more parameters vary at same time. This
program allow c,d,p,q each vary while hold
other three constant.
2009-03-06-18-17 start drawing code
2009-03-06-20-06 done drawing code
Draw curve, do not see anything exciting.
Upload thid drawing code to Internet, let
everyone take a look. Maybe some one will
find hint from drawing.
Thank you for visiting Freeman's site.
Goodby.
Freeman.
2009-03-06-20-39
<a name="980307a">
2009-03-07-12-22
Above mention goto page
http://freeman2.com/graph09e.htm
Now this file added button, please goto
a name=graph02
Click "draw 602" to get curve directly.
From this curve, estimate m=0.7 is approx.
solution. From approx. solution to exact
solution
m=0.688453227107702105
Freeman use a poor method. Good method like
Newton's iteration method no need hand work.
Freeman can not use Newton's iteration method
because I do not have such program in hand.
<a name="980307b">index
Another thing reader can try is to find
f(x)=x^i
where x is a real number and i=sqrt(-1).
Please goto a name=graph01
base complex: c [2] *exp(i*d [0] )
power complex: p [0] +i*q [1]
in four boxes, fill in the following values
2 ,c box
0 ,d box
0 ,p box
1 ,q box
<a name="980307c">
then equation [c*exp(i*d)]^(p+i*q)
become [2*exp(i*0)]^(0+i*1)
that is 2^i
click "c indep" 2^i become t^i
program change '2' to variable 't'
click "c indep" get a curve.
this file problem 1 answer is
4.810477380965351^i=i
therefore
<a name="980307d">
step size [ ] starting point [ ] end point [ ]
let start/end range include 4.810477380965351
for example assign end point at 4.82 , click
"c indep" , curve just stop at (0,1) this point
(0,1) represent real=0, imag.=1 that is 0+i
this i is the 'i' right to '=' in
4.810477380965351^i=i
'i' left to '=' is defined in
0 ,p box (real=0)
1 ,q box (imag=1)
Freeman 2009-03-07-12-43
<a name="980307e">index
2009-03-07-19-18 start
This file added drawing function, hope to get
hint. It really works.
Above mentioned
[[
in four boxes, fill in the following values
2 ,c box
0 ,d box
0 ,p box
1 ,q box
then equation [c*exp(i*d)]^(p+i*q)
become [2*exp(i*0)]^(0+i*1)
that is 2^i
click "c indep" 2^i become t^i
program change '2' to variable 't'
]]
<a name="980307f">
Found that when real base number increase
function t^i value loop on unit circle
forever. Imaginary point i=(0,1) passed
infinite many times, that is, the equation
x^i=i
has infinite many solutions. Following is
work record.
<a name="980307g">
2009-03-07-18-53
x^i=i
has infinite many solutions.
from (A28) and (A29) get
0*d+log(c^1)=PI/2 ==> c=exp(PI/2) -----(A30)
insert 2*n*PI not change cos() value,
and not change sin() value.
0*d+log(c^1)= 2*n*PI + PI/2
therefore for any integer number n
x=c=exp(2*n*PI+PI/2) -----(A30A)
is a general solution.
2009-03-07-18-56
<a name="980307h">
n=0 : 2*n*PI+PI/2=
1.5707963267948965
exp(1.5707963267948965)=
4.810477380965351 this is solution for n=0
4.810477380965351^i=
6.123031769111886e-17,1 verified, correct.
[ hint: right hand side is 6.123031769111886e-17,1
that is 0,1 that is i , whole equation is
exp(1.5707963267948965)^i=i
or 4.810477380965351^i=i
this is problem 1 x^i=i
x=4.810477380965351 is a solution
2009-03-11-14-58
]
n=1 : 2*n*PI+PI/2=
7.853981633974483
exp(7.853981633974483)=
2575.9704965975697 this is solution for n=1
2575.9704965975697^i=
3.061515884555943e-16,1 verified, correct.
<a name="980307i">
n=2 : 2*n*PI+PI/2=
14.137166941154069
exp(14.137166941154069)=
1379410.7058059827 this is solution for n=2
1379410.7058059827^i=
5.510728592200698e-16,1 verified, correct.
2009-03-07-19-03
n=-1 :
2*n*PI+PI/2
= -4.71238898038469
exp(-4.71238898038469)=
0.008983291021129429 this is solution for n=-1
0.008983291021129429^i=
-1.836909530733566e-16,1 verified, correct.
2009-03-07-19-06
2009-03-07-19-37 record stop
<a name="980308a">index
2009-03-08-10-07 start
When solve problem, initially, pay attention
to whether there is a solution. After get
solution, then pay attention to how many
solution exist?
2009-03-07-18-53 paid attention to
x^i=i has infinite many solution.
2009-03-07-21-32 paid attention to
x^i=i has infinite many solution.
i^x=x has how many solution?
<a name="980308b">
this moment look at "Draw 602", and
write "Draw 603"
"Draw 602" focus on first zero point.
"Draw 603" draw whole curve.
"Draw 602" and "Draw 603" are for same
equation, but different range.
Problem 2 i^x=x find x , during this process
need solve m and n from next two equations
m=exp(-n)*cos(m)*PI/2 -----(B25)
n=exp(-n)*sin(m)*PI/2 -----(B26)
<a name="980308c">
To find m,n , eliminate n first, then left
a equation which has only m as variable.
"Draw 602" and "Draw 603" default equation is
next. (change m to t)
t*t+(t*sin(t)/cos(t))*(t*sin(t)/cos(t))
-exp(-t*sin(t)/cos(t))
*exp(-t*sin(t)/cos(t))*(PI*PI/2/2) -----(B30)
above three lines should string to one line
and it is one equation.
<a name="980308d">
Because curve shape like book, name this
equation (B30) as book curve.
A public telephone has a phone book hanging
there. Binding end up, open end down. Each
page vertical up/down like book curve.
From book curve we can guess (not a proof)
i^x=x has infinite many solution. Now I
am still thinking the analytic solution for
equation (B25) and (B26).
2009-03-08-10-20 stop
<a name="980309a">index
2009-03-09-10-50 record start
Below is partial work record for finding
solution for i^x=x
where x=p+i*q
[[
let R=p+i*q
let S=p-i*q
2009-03-08-22-32
]]
<a name="980309b">
2009-03-09-04-15
Next equation
R=exp(+i*R*PI/2) -----(B31)
is correct,
How to solve for R ?
<a name="980309c">
2009-03-09-04-27
Next equation
S=exp(-i*S*PI/2) -----(B32)
is correct,
How to solve for S ?
<a name="980309d">
2009-03-09-10-33
spend one day find
R=exp(+i*R*PI/2) -----(B31)
is correct,
how to solve (B31) for R ?
[[
2009-03-05-15-50 Next equation is correct
p=exp(-q*PI/2)*cos[p*PI/2] -----(B15)
q=exp(-q*PI/2)*sin[p*PI/2] -----(B16)
]]
2009-03-09-10-40
(B15) and (B16) combined to form (B31)
Until now, I can know at one reading that
(B15) and (B16) are same as (B31)
two expressions are one thing.
2009-03-09-11-03 record stop.
<a name="980309e">
exp(i*real) length is one
exp(i*complex) length is NOT one
Because the result equation has one extra
term exp(-q*PI/2) which change
cos[p*PI/2]+i*sin[p*PI/2]
length from one to other value.
2009-03-09-11-09 record stop
2009-03-11-15-27 translation stop
complex^complex equation: [c*exp(i*d)]^(p+i*q)
One of four c,d,p,q is independent variable,
other three must assign a number.
step size
starting point
end point
base complex: c
*exp(i*d
)
default base (1+2i)
power complex: p
+i*q
default power (3+4i)
x axis lower
/upper
bound
lower/upper bound
y axis lower
/upper
bound
affect aspect ratio.
drawing method
Above belong to "Draw 601", but no "Modify 601"
button, because "Draw 601" not read data from
"Modify 601" 9803070919
All curve squeeze to a point? narrow down upper/lower limit.
All curve fly away to nowhere? relax upper/lower limit.
Box 4, curve equation
Box 5, curve data
<a name=graph02>index
When solve i^x=x for x , intermediate step
find approx. sol. Please click "Draw 602"
<a name=graph03>index
Equation i^x=x solve for x required curve.
"Draw 602" display first zero point
"Draw 603" display whole curve.
"Draw 602" and "Draw 603" use same equation,
but different range.
2009-03-11-17-13 translation to here
Above this point, the equivalent Chinese page is
http://freeman2.com/tutc0006.htm
Below this point, "goodby01" and "goodby02"
the equivalent Chinese page is
http://freeman2.com/rocsiteu.js
2009-03-11-17-17
<a name=goodby01>index
Freeman make few statement as below
Freeman's recent activity:
Expect say goodby to Internet (to save money
from support my web site)
Expect move out from current residential.
move to Gardena CA (time stamp 9803041608)
Three person three rent, too high the load.
Three person two rent, reduce the load.
After move, Freeman's free time all gone.
No programming time any more,
No self study time any more,
No political speech time any more,
GOODBY!!
<a name=goodby02>
On 2009-03-03 pay rent time, Freeman leave a
message to landlord as below
"Please get money before 2009-03-09, critical"
On 2009-03-10 Earthlink get money from my bank
account, there will be not enough fund.
GOODBY !! 9803042016
2009-03-05-12-42
<a name=goodby03>
On 2009-03-11 Earthlink.net withdraw money from Liu's
bank account. Not enough money in checking account, Bank
auto transfer money from saving account. Crisis shift to
2009-04-10. record on 2009-03-11-21-18
<a name=goodby04>
On 2009-03-24 Freeman received refund check from UCLA
dental school $535. Same day deposited to Freeman's
checking account. Close-site (freeman2.com) crisis
shift to 2009-05-10. record on 2009-03-25-08-44