Should numpy.sqrt(-1) return 1j rather than nan?
James Graham
jg307 at cam.ac.uk
Thu Oct 12 09:14:33 CDT 2006
Greg Willden wrote:
> On 10/11/06, *Bill Baxter* <wbaxter at gmail.com
> <mailto:wbaxter at gmail.com>> wrote:
>
> On 10/12/06, Greg Willden <gregwillden at gmail.com
> <mailto:gregwillden at gmail.com>> wrote:
> > Speed should not take precedence over correctness.
>
> Unless your goal is speed. Then speed should take precedence over
> correctness.
>
>
> Huh?
> Person 1: "Hey you should use function X."
> Person 2: "No, it doesn't give me the correct answer."
> Person 1: "Who cares? It's fast!"
>
> What kind of logic is that?
>
> I'm having serious doubts about my conversion to Numpy.
It's more like
Person 1: Function x is designed to be fast, have predictable memory usage and
so be suitable for a wide variety of applications. Alternatively there is
function y which is slower but handles a larger numerical domain. y Might be
more sutiable for your needs; you should use it.
Person 2: Numpy is broken! Function x should just do what I want!
Really, given that both options are available, I don't see a big issue here.
Claims that returning j for sqrt(-1) is "more correct" seem highly dubious as a)
NumPy is a numerical library, not an algebraic one, hence the fact that it
behaves in a type-dependent way is not so surprising, and b) no one complains
that functions like sqrt return only positive floats, despite the fact that,
mathematically, this function is multivalued.
--
"Eternity's a terrible thought. I mean, where's it all going to end?"
-- Tom Stoppard, Rosencrantz and Guildenstern are Dead
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
More information about the Numpy-discussion
mailing list