[Numpy-discussion] calcul of phase (dividing by 0)

Andrew P. Lentvorski, Jr. bsder at mail.allcaps.org
Thu Feb 10 15:04:12 EST 2005


On Feb 10, 2005, at 6:16 AM, Jean-Luc Menut wrote:

> My problem comes when ff.real = 0, I have either inf or nan as result 
> (which is perfectly good and useful). I looking for a function which 
> replace atan(ff.imag/ff.real) by 0 when ff.real is 0.

I would probably use atan2.

However, do you really want to replace atan(ff.imag/ff.real) by 0 when 
ff.real is 0?

I would expect that you want to replace it with +- pi/2 depending upon 
the sign of ff.imag.

-a





More information about the NumPy-Discussion mailing list