[Tutor] Complex roots

Jacob S. keridee at jayco.net
Thu Dec 16 04:27:25 CET 2004

Finding the all the roots of a complex number shouldn't be too difficult. I
tend to do it on paper sometimes. Maybe I can write a script to do it for me
instead.  I stongly caution you though. The methods that I show below are
unstable and should be verified by a math web site as it has been quite a
few months since I last used the equations. In fact, I'll almost bet they're
wrong. If you want me to check them, I'll gladly google for the right
equations if you want.

where i == sqrt(-1)

p = (a+bi)**n
n = polar(p)  ## polar is a function that converts rectangular coordinates
to polar coordinates.
radius = n[0]
angle = n[1]

1st root        radius**n cis (angle/(180*n))  ## Where cis is short for
(cos(angle) + i*sin(angle))
2nd root        radius**n cis (angle/(360*n))
qth root        radius**n cis (angle/(180*q*n))

So saying, I would set a for i in range loop for n times to run these root
finders through. Note unless you call some sort of polar to rectangular
function on the roots, they will still be in polar.

HTH as always,
Jacob Schmidt

More information about the Tutor mailing list