tanm — SciPy v1.15.3 Manual (original) (raw)

scipy.linalg.

scipy.linalg.tanm(A)[source]#

Compute the matrix tangent.

This routine uses expm to compute the matrix exponentials.

Parameters:

A(N, N) array_like

Input array.

Returns:

tanm(N, N) ndarray

Matrix tangent of A

Examples

import numpy as np from scipy.linalg import tanm, sinm, cosm a = np.array([[1.0, 3.0], [1.0, 4.0]]) t = tanm(a) t array([[ -2.00876993, -8.41880636], [ -2.80626879, -10.42757629]])

Verify tanm(a) = sinm(a).dot(inv(cosm(a)))

s = sinm(a) c = cosm(a) s.dot(np.linalg.inv(c)) array([[ -2.00876993, -8.41880636], [ -2.80626879, -10.42757629]])