import numpy as np x = np.array([0., 0.5, 1.]) identity = np.cosh(x) ** 2 - np.sinh(x) ** 2 print(np.allclose(identity, 1., atol=1e-12)) print(np.isclose(np.arctanh(np.tanh(0.5)), 0.5))