Further to my previous post, please find some code below:

Hope this helps,
Matt

#Complex number Roots
#Matt Williams 9.12.04

import math

number=complex(0.5,0)
n=float(3)

size=math.sqrt((number.real**2)+(number.imag**2))


arg=math.radians(360/n)

root=1/n

modulus=size**root

theta=float(0)
roots={}
i=0
while i<n:
    y=round(modulus*(math.sin(theta)),3)
    x=round(modulus*(math.cos(theta)),3)
    roots[i]=(x,y)
    theta=theta+arg
    i=i+1

print roots

_______________________________________________
Tutor maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to