[Numpy-discussion] Re: Change definition of complex sign (and use it in copysign)

2024-01-04 Thread Marten van Kerkwijk
Hi All, Thanks for the comments on complex sign - it seems there is good support for it. On copysign, currently it is not supported for complex values at all. I think given the responses so far, it looks like we should just keep it like that; although my extension was fairly logical, I cannot

[Numpy-discussion] Re: Change definition of complex sign (and use it in copysign)

2024-01-04 Thread Dom Grigonis
I think this suggestion regarding sign is solid. From both theoretical and practical points of view. And agree with all of Aaron’s points as well. Regards, DG > On 4 Jan 2024, at 22:58, Robert Kern wrote: > > On Wed, Jan 3, 2024 at 4:09 PM Aaron Meurer > wrote: >

[Numpy-discussion] Re: Change definition of complex sign (and use it in copysign)

2024-01-04 Thread Robert Kern
On Wed, Jan 3, 2024 at 4:09 PM Aaron Meurer wrote: > sign(z) = z/|z| is a fairly standard definition. See > https://oeis.org/wiki/Sign_function and > https://en.wikipedia.org/wiki/Sign_function. It's also implemented > this way in MATLAB and Mathematica (see >

[Numpy-discussion] Re: Change definition of complex sign (and use it in copysign)

2024-01-03 Thread Aaron Meurer
sign(z) = z/|z| is a fairly standard definition. See https://oeis.org/wiki/Sign_function and https://en.wikipedia.org/wiki/Sign_function. It's also implemented this way in MATLAB and Mathematica (see https://www.mathworks.com/help/symbolic/sign.html and

[Numpy-discussion] Re: Change definition of complex sign (and use it in copysign)

2023-12-23 Thread Dom Grigonis
To me this sounds like a reasonable change. It does seem like there is a return value which is more sensible than alternatives. And the fact that sympy is already doing that indicates that same conclusion was reached more than once. I am not dealing much with complex numbers at the moment,

[Numpy-discussion] Re: Change definition of complex sign (and use it in copysign)

2023-12-22 Thread Oscar Benjamin
On Fri, 22 Dec 2023 at 13:25, wrote: > > Anyway, to me the main question would be whether this would break any > workflows (though it is hard to see how it could, given that the previous > definition was really rather useless...). SymPy already defines sign(z) as z/abs(z) (with sign(0) = 0) as

[Numpy-discussion] Re: Change definition of complex sign (and use it in copysign)

2023-12-22 Thread Neal Becker
In my opinion, with the caveat that anyone that asks for the sign of a complex number gets what they deserve, this seems about as useful a definition as any. On Fri, Dec 22, 2023 at 8:23 AM wrote: > Hi All, > > A long-standing, small wart in numpy has been that the definition of sign > for