[Numpy-discussion] numpy.arccos(numpy.inf)????
Robert Kern
robert.kern@gmail....
Fri May 16 13:39:01 CDT 2008
On Fri, May 16, 2008 at 1:37 PM, Robert Kern <robert.kern@gmail.com> wrote:
> On Fri, May 16, 2008 at 11:47 AM, Stuart Brorson <sdb@cloud9.net> wrote:
>> 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?
>
> Hmm, this works fine on OS X.
Sorry, I'm an idiot. I get the same results as you when I read the
message correctly.
In [2]: arccos(inf+0j)
Out[2]: (nan+-infj)
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion
mailing list