[Numpy-discussion] Power domain (was Re: bug in oldnumeric.ma)
Sat May 10 02:54:34 CDT 2008
Anne Archibald wrote:
> 2008/5/9 Eric Firing <firstname.lastname@example.org>:
>> It seems like some strategic re-thinking may be needed in the long run,
>> if not immediately.
> I think in principle the right answer is to simply run whatever
> underlying function, and mask any NaNs or Infs in the output.
Did you already rule out promoting to complex based on the type
information of the power args? I see that already:
>> power( -3.0 , arange(2.8, 3.2, 0.1) )
Warning: invalid value encountered in power
array([ NaN, NaN, -27., NaN, NaN])
>>> power( -3.0*(1+0j) , arange(2.8, 3.2, 0.1) )
array([-17.53465227+12.73967059j, -23.00689255 +7.47539254j,
-27.00000000 +0.j , -28.66039788 -9.31232777j,
This gives a continuous function. So, multiply by (1+0j) and mask
according to the .imag parts of the answers. It would have made more
sense to have power(real, real) return complex, but of course that may
break some code.
More information about the Numpy-discussion