Linear dynamical systems
Convert a continuous-time linear system matrix into a finite-time state-transition matrix.
SciPy · Function
Computes the matrix exponential of a square array, including arrays with leading batch dimensions. It uses a variable-order Padé approximation and returns an array shaped like the input.
Pass a square NumPy array, or an array with batch dimensions followed by two equal dimensions. SciPy evaluates the matrix exponential using a variable-order Padé approximation selected from the input data and returns an array with the same shape.
scipy.linalg.expm(A)| Name | Type | Description |
|---|---|---|
A | ndarray | Input array whose final two dimensions are square; optional leading dimensions represent batches. |
ndarray: The matrix exponential, with the same shape as A.
import numpy as np
from scipy.linalg import expm
A = np.array([[0.0, 1.0], [-1.0, 0.0]])
print(expm(A))Computes the exponential of a two-dimensional rotation generator.
Convert a continuous-time linear system matrix into a finite-time state-transition matrix.
Evaluate matrix-valued exponentials for rotations, diffusion, or other linear operators.
Apply the same matrix-exponential operation independently across several matrices stored in one array.
scipy.linalg.expm use?expm(A) computes the matrix exponential of a square array. The implementation uses a variable-order Padé approximation whose order is chosen from the array data.
Follow-up: What happens with batched input? Arrays whose final two dimensions are square are interpreted as batches of lower-dimensional matrices, and the output preserves the complete shape.
The input must have square last two dimensions, with shape (..., n, n). The result is an array with the same shape as the input.
Follow-up: Why might the result require extra memory? The implementation can use worst-case memory on the order of 8*(n**2) for an n-by-n input.
For dimensions at least 400, the method uses 1-norm estimation to help determine the approximation order because its cost becomes preferable to exact computation. The threshold is based on the matrix dimension n.
Follow-up: What dtype-related allocation should be considered? Inputs outside single or double precision real or complex dtypes are copied into a new array.
scipy.linalg.logmscipy.linalg.sinmscipy.linalg.cosmscipy.linalg.solve