Function expm #
Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.
The exponential is calculated using the Padé approximant with scaling and squaring; see “Nineteen Dubious Ways to Compute the Exponential of a Matrix,” by Moler and Van Loan.
Syntax #
math.expm(x)
Parameters #
Parameter | Type | Description |
---|---|---|
x |
Matrix | A square Matrix |
Returns #
Type | Description |
---|---|
Matrix | The exponential of x |
Throws #
Type | Description —- | ———–
Examples #
const A = [[0,2],[0,0]]
math.expm(A) // returns [[1,2],[0,1]]