numpy.arctanh(x) for x >= 1 returns NaN but I want complex numpy.arctanh(x) for x >= 1 returns NaN but I want complex numpy numpy

numpy.arctanh(x) for x >= 1 returns NaN but I want complex


Add +0j to your real inputs to make them complex numbers.

Numpy is following a variation of the maxim "Garbage in, Garbage out."

Float in, float out.

>>> import numpy as np>>> np.sqrt(-1)__main__:1: RuntimeWarning: invalid value encountered in sqrtnan

Complex in, complex out.

>>> numpy.sqrt(-1+0j)1j>>> numpy.arctanh(24+0j)(0.0416908044695255-1.5707963267948966j)