This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / linalg / _matfuncs / cosm

function

scipy.linalg._matfuncs:cosm

source: build-install/usr/lib/python3.14/site-packages/scipy/linalg/_matfuncs.py:437

Signature

def cosm(A)

Summary

Compute the matrix cosine.

Extended Summary

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 linalg_batch for details. The NEP 5 signature of this function is (i,i)->(i,i).

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)
cosm(a) + 1j*sinm(a)
✗
array([[ 0.43+1.89j, -2.14-0.98j],
       [ 1.07+0.49j, -1.71+0.91j]])

Aliases

  • scipy.linalg.cosm