On Thu, Jul 17, 2008 at 3:56 PM, Pauli Virtanen <pav@iki.fi> wrote:
Mon, 17 Mar 2008 08:07:38 -0600, Charles R Harris wrote:
[clip]
> 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__
'1.2.0.dev5436.e45a7627a39d'
>>> np.arccosh(-1e-9 + 0.1j)
(-0.099834078899207618-1.5707963277899337j)
>>> np.arccosh(1e-9 + 0.1j)
(0.099834078899207576+1.5707963257998594j)
>>> np.arccosh(-1e-9 - 0.1j)
(-0.099834078899207618+1.5707963277899337j)
>>> np.arccosh(1e-9 - 0.1j)
(0.099834078899207576-1.5707963257998594j)

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...)

Hmm,

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. Note

arccosh z = ln(z + sqrt(z-1) sqrt(z+1) )    not sqrt(z**2-1)

So I guess that is the fix.

Chuck