Velocity Reviews > Re: Problem with complex numbers

# Re: Problem with complex numbers

Christian Heimes
Guest
Posts: n/a

 03-22-2008
Matthias Götz schrieb:
> So can you tell me what's the purpose of Complex.py,
>
> 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, although the
mathematical proof isn't trivial. You have to use the Euler form. Ask

Christian

David C. Ullrich
Guest
Posts: n/a

 03-23-2008
On Sat, 22 Mar 2008 23:29:10 +0100, Christian Heimes
<(E-Mail Removed)> wrote:

>Matthias Götz schrieb:
>> So can you tell me what's the purpose of Complex.py,
>>
>> 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...

Thanks.

>Christian

David C. Ullrich