[SciPy-user] How to get sqrt(-1) = 1j per default?

Robert Kern robert.kern@gmail....
Sun Jul 12 14:56:55 CDT 2009


On Sun, Jul 12, 2009 at 14:42, Nicolas Gruel<humufr@yahoo.fr> wrote:
>
> Why keeping the numpy comportment (NaN)? If it's only for historical reason and it's mathematicaly better to have 1j, this behaviour should be corrected. It was a limitation of numeric but numpy has been written to extend and to remove the limitation.

Both behaviors are useful in different situations. It was not a
limitation of Numeric but rather a specific design decision. Quite
often, passing a negative number to sqrt() is an error that needs to
be detected. That's why the standard library has math.sqrt(-1) which
raises and exception while cmath.sqrt(-1) returns 1j.

-- 
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 SciPy-user mailing list