At 08:17 AM 4/21/2008, Dick Moores wrote: >At 07:40 PM 4/20/2008, John Fouhy wrote: > >If you're going to be working with complex numbers, you might be > >better off looking at scipy or some other module that provides more > >mathematical grunt. > >Try mpMath (<http://code.google.com/p/mpmath/>) > >With version 0.7: > > >>> from mpmath import power, mpf > >>> print power(-20,(1.0/3.0)) >(1.35720880829745 + 2.3507546124512j)
I needn't have imported mpf >>> from mpmath import power >>> print power(-20,(1.0/3.0)) (1.35720880829745 + 2.3507546124512j) Dick >Or, to a precision of, say, 43: > > >>> mp.dps = 43 > >>> print power(-20,(1.0/3.0)) >(1.357208808297453347178047801626363199806658 + >2.350754612451197324056065041655768179779947j) > >Dick Moores ================================ UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/ _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor