Complex numbers, abs results in mag, what results in phase?

Alex Martelli aleax at aleax.it
Thu Nov 7 17:53:18 EST 2002


noyb wrote:

> I realize the angle is atan(b,a) but I need to use my_complex_variable
> as input and not a,b.

import math
def phase(mcv):
    return math.atan2(mcv.imag, mcv.real)

I don't think there's any Python built-in that does this.


Alex




More information about the Python-list mailing list