[Numpy-discussion] numpy.arccos(numpy.inf)????

Anne Archibald peridot.faceted at gmail.com
Fri May 16 17:57:28 EDT 2008


2008/5/16 Stuart Brorson <sdb at cloud9.net>:
> Hi --
>
> Sorry to be a pest with corner cases, but I found another one.
>
> In this case, if you try to take the arccos of numpy.inf in the
> context of a complex array, you get a bogus return (IMO).  Like this:
>
> In [147]: R = numpy.array([1, numpy.inf])
>
> In [148]: numpy.arccos(R)
> Warning: invalid value encountered in arccos
> Out[148]: array([  0.,  NaN])
>
> In [149]: C = numpy.array([1+1j, numpy.inf])
>
> In [150]: numpy.arccos(C)
> Warning: invalid value encountered in arccos
> Out[150]: array([ 0.90455689-1.06127506j,         NaN       -Infj])
>
> The arccos(numpy.inf) in the context of a real array is OK, but taking
> arcocs(numpy.inf) in the context of a complex array should return
> NaN + NaNj, IMO.
>
> Thoughts?

Is this so bad?

lim x->inf arccos(x) = -j inf

Granted this is only when x approaches infinity along the positive real axis...

Anne



More information about the NumPy-Discussion mailing list