[Numpy-discussion] arccosh for complex numbers, goofy choice of branch
Charles R Harris
Thu Jul 17 17:25:06 CDT 2008
On Thu, Jul 17, 2008 at 3:56 PM, Pauli Virtanen <firstname.lastname@example.org> wrote:
> Mon, 17 Mar 2008 08:07:38 -0600, Charles R Harris wrote:
> > OK, that does it. I'm going to change it's behavior.
> The problem with bad arccosh branch cuts is still present:
> >>> import numpy as np
> >>> numpy.__version__
> >>> np.arccosh(-1e-9 + 0.1j)
> >>> np.arccosh(1e-9 + 0.1j)
> >>> np.arccosh(-1e-9 - 0.1j)
> >>> np.arccosh(1e-9 - 0.1j)
> Ticket #854. http://scipy.org/scipy/numpy/ticket/854
> I'll write up some tests for all the functions with branch cuts to verify
> that the cuts and their continuity are correct. (Where "correct" bears
> some resemblance to "ISO C standard", I think...)
The problem here is arccosh = log(x + sqrt(x**2 - 1))
when the given numbers are plugged into x**2 - 1, one lies above the
negative real axis, the other below and the branch cut [-inf,0] of sqrt
introduces the discontinuity. Maybe sqrt(x - 1)*sqrt(x+1) will fix that. I
do think the branch cut should be part of the documentation of all the
complex functions. I wonder what arccos does here?
Ah, here is a reference. <http://www.cs.umbc.edu/help/theory/identities.txt>Note
arccosh z = ln(z + sqrt(z-1) sqrt(z+1) ) not sqrt(z**2-1)
So I guess that is the fix.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion