[SciPy-dev] Numpy example for arctan2 perhaps wrong/misleading/confusing?
David Huard
david.huard@gmail....
Mon Jun 9 13:08:27 CDT 2008
2008/6/9 Samuel John <scipy@samueljohn.de>:
> 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*...
>
What version of Numpy are you using ? Here is what I have:
Return the angle of the complex argument z.
Examples
--------
>>> numpy.angle(1+1j) # in radians
0.78539816339744828
>>> numpy.angle(1+1j,deg=True) # in degrees
45.0
>
>
> --
> Samuel
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-dev/attachments/20080609/0fa61c26/attachment.html
More information about the Scipy-dev
mailing list