Previous topic

scipy.linalg.sinhm

Next topic

scipy.linalg.signm

scipy.linalg.tanhm

scipy.linalg.tanhm(A)[source]

Compute the hyperbolic matrix tangent.

This routine uses expm to compute the matrix exponentials.

Parameters:

A : (N, N) array_like

Input array

Returns:

tanhm : (N, N) ndarray

Hyperbolic matrix tangent of A

Examples

>>> from scipy.linalg import tanhm, sinhm, coshm
>>> a = np.array([[1.0, 3.0], [1.0, 4.0]])
>>> t = tanhm(a)
>>> t
array([[ 0.3428582 ,  0.51987926],
       [ 0.17329309,  0.86273746]])

Verify tanhm(a) = sinhm(a).dot(inv(coshm(a)))

>>> s = sinhm(a)
>>> c = coshm(a)
>>> t - s.dot(np.linalg.inv(c))
array([[  2.72004641e-15,   4.55191440e-15],
       [  0.00000000e+00,  -5.55111512e-16]])