Re: [Numpy-discussion] Infinity as nan as real part

2008-06-25 Thread Robert Kern
On Wed, Jun 25, 2008 at 15:16, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > 2008/6/25 Robert Kern <[EMAIL PROTECTED]>: >> In [1]: from numpy import * >> >> In [3]: 1j == (0+1j) >> Out[3]: True >> >> In [4]: 0*inf >> Out[4]: nan > > Fair enough. > > How about > > z = np.complex(0, np.inf) > z**2

Re: [Numpy-discussion] Infinity as nan as real part

2008-06-25 Thread Stéfan van der Walt
2008/6/25 Robert Kern <[EMAIL PROTECTED]>: > In [1]: from numpy import * > > In [3]: 1j == (0+1j) > Out[3]: True > > In [4]: 0*inf > Out[4]: nan Fair enough. How about z = np.complex(0, np.inf) z**2 == (nannanj) Shouldn't that be -inf? Regards Stéfan ___

Re: [Numpy-discussion] Infinity as nan as real part

2008-06-25 Thread Charles R Harris
On Wed, Jun 25, 2008 at 6:42 AM, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > Hi all, > > Why can't a person construct a complex number with an infinite complex > part and a zero real part? > > 1 + 1j*np.inf == (nan + infj) # because np.inf * 1j == (nan + infj) > > There is a workaround: > > z

Re: [Numpy-discussion] Infinity as nan as real part

2008-06-25 Thread Robert Kern
On Wed, Jun 25, 2008 at 07:42, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > Hi all, > > Why can't a person construct a complex number with an infinite complex > part and a zero real part? > > 1 + 1j*np.inf == (nan + infj) # because np.inf * 1j == (nan + infj) In [1]: from numpy import * In [3

[Numpy-discussion] Infinity as nan as real part

2008-06-25 Thread Stéfan van der Walt
Hi all, Why can't a person construct a complex number with an infinite complex part and a zero real part? 1 + 1j*np.inf == (nan + infj) # because np.inf * 1j == (nan + infj) There is a workaround: z = np.array([0], dtype=complex) z.imag = np.inf but that's not very pleasant. Is this a bug, or