This is a pre-release version (latest).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy latest / scipy / sparse / linalg / _matfuncs / expm

function

scipy.sparse.linalg._matfuncs:expm

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

Signature

def expm(A)

Summary

Compute the matrix exponential using Pade approximation.

Parameters

A : (M,M) array_like or sparse array

2D Array or Matrix (sparse or dense) to be exponentiated

Returns

expA : (M,M) ndarray

Matrix exponential of A

Notes

This is algorithm (6.1) which is a simplification of algorithm (5.1).

Examples

from scipy.sparse import csc_array
from scipy.sparse.linalg import expm
A = csc_array([[1, 0, 0], [0, 2, 0], [0, 0, 3]])
✓
A.toarray()
✗
array([[1, 0, 0],
       [0, 2, 0],
       [0, 0, 3]])
Aexp = expm(A)
✓
Aexp
Aexp.toarray()
✗
array([[ 2.71828,  0.     ,  0.     ],
       [ 0.     ,  7.38906,  0.     ],
       [ 0.     ,  0.     , 20.08554]])

Aliases

  • scipy.sparse.linalg.expm

Referenced by