[Tutor] How to get the 2 complex cube roots of 1?

Alan Gauld alan.gauld at freenet.co.uk
Thu Dec 9 13:34:54 CET 2004


> My trusty $10 Casio calculator tells me that the 3 cube roots of 1
are:
> 1, (-.5 +0.866025403j), and (-.5 -0.866025403j), or thereabouts. Is
there
> a way to do this in Python?

Sorry the power operation in Python will only return 1+0j
You need to dig out the math books and write a function
to return all the roots. Or hunt google to see if somebody
else has already done one...

Alan G



More information about the Tutor mailing list