林培恒 wrote: > On Mon, 24 Sep 2007, Terry Carroll write: > >> My math is rusty. Is there a concept of "greater than" >> or "largest" in complex numbers on different axis? Which >> is larger, 4+2i or 2+4i? > > In fact, complex numbers can not compare directly. People always compare > complex numbers with their 'model'. For example, sqrt(a**2 + b**2) is the > 'model' of a+bi.
i think you mean "modulus". Also, you can get it directly. The abs builtin does it for you. >>> foo = 3+4j >>> print abs(foo) I don't think there is a direct way to the get the argument. You'd have to use arctan for that. -- ~noufal _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor