[SciPy-dev] Numpy example for arctan2 perhaps wrong/misleading/confusing?

Samuel John scipy@SamuelJohn...
Mon Jun 9 10:59:34 CDT 2008


Hi!

> What you want is this :
>
>> [4]: def arctan2(vectors):
>    ...:     """Return the angle between the x axis and each vector in
> vectors."""
>    ...:     v = np.atleast_2d(vectors)
>    ...:     return np.arctan2(v[:,0], v[:,1])
>    ...:
>
>> [5]: arctan2(([0,0], [1,0]))
> < [5]: array([ 0.        ,  1.57079633])

Indeed, very nice.


> You could also use the numpy.angle function which returns the angle of a
> complex argument.
>
>> [15]: np.angle([0, 1j])
>  <[15]: array([ 0.        ,  1.57079633])

Cool, I was not aware of this function. Perfect.
Unfortunately there is no docstring *g*...


-- 
 Samuel


More information about the Scipy-dev mailing list