scipy.linalg.
cosm#
- scipy.linalg.cosm(A)[source]#
- Compute the matrix cosine. - This routine uses expm to compute the matrix exponentials. - The documentation is written assuming array arguments are of specified “core” shapes. However, array argument(s) of this function may have additional “batch” dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see Batched Linear Operations for details. - Parameters:
- A(N, N) array_like
- Input array 
 
- Returns:
- cosm(N, N) ndarray
- Matrix cosine of A 
 
 - Examples - >>> import numpy as np >>> from scipy.linalg import expm, sinm, cosm - Euler’s identity (exp(i*theta) = cos(theta) + i*sin(theta)) applied to a matrix: - >>> a = np.array([[1.0, 2.0], [-1.0, 3.0]]) >>> expm(1j*a) array([[ 0.42645930+1.89217551j, -2.13721484-0.97811252j], [ 1.06860742+0.48905626j, -1.71075555+0.91406299j]]) >>> cosm(a) + 1j*sinm(a) array([[ 0.42645930+1.89217551j, -2.13721484-0.97811252j], [ 1.06860742+0.48905626j, -1.71075555+0.91406299j]])