Problem with complex numbers

David C. Ullrich dullrich at
Sun Mar 23 15:25:54 CET 2008

On Sat, 22 Mar 2008 23:29:10 +0100, Christian Heimes
<lists at> wrote:

>Matthias Götz schrieb:
>> So can you tell me what's the purpose of,
>> and where can i find the semantic i'am looking for.
>Well, the file is in the Demo folder. It's just a demo how to implement
>a naive complex type in Python.
>Why do you think the power of a complex to a complex is not defined?
>Raising a complex to a complex power is well defined, 

Really? One of the problems that used to show up on the master's
exams aroung here was to find all the possible values of i**i.

>although the
>mathematical proof isn't trivial. You have to use the Euler form. 

Erm, the problem is that the Euler form of a complex number is
not well-defined (_unless_ you specify that the argument is
between -pi and pi). For example, i = exp(i pi/2) and also
i = exp(i 5*pi/2); those two "forms" give different values for i**i.

You might say that a complex power of an Euler form for a
complex number is well-defined.

If you do specify that -pi < argument <= pi, ie you consider
the principal-value logarithm, then you get exactly one z**w.
But that's not always the z**w that you need for your problem...

>Google for some examples



David C. Ullrich

More information about the Python-list mailing list