Skip to content

expm

Matrix exponential.

X = expm(A)

Returns the matrix exponential exp(A) — the matrix-valued sum I + A + A²/2! + A³/3! + …. Computed via the scaling-and-squaring Padé method (much more accurate than the elementwise exp(A), which gives a different result entirely).

Used in solving linear ODEs of the form dy/dt = A*y whose solution is y(t) = expm(A*t) * y(0).

expm(zeros(3)) % I
A = [0 1; -1 0];
expm(A * pi) % approximately -I (rotation by π)
  • sqrtm — Matrix square root.
  • eig — Eigenvalues and eigenvectors.