Return the exponential of a matrix by adaptive Taylor series expansion with scaling and balancing

Wolfram Language



This information is part of the Modelica Standard Library maintained by the Modelica Association.


phi = Matrices.exp(A);
phi = Matrices.exp(A,T=1);


This function computes the exponential eAT of matrix A, i.e.

                       (AT)^2   (AT)^3
 Φ = e^(AT) = I + AT + ------ + ------ + ....
                         2!       3!

where e=2.71828..., A is an n x n matrix with real elements and T is a real number, e.g., the sampling time. A may be singular. With the exponential of a matrix it is, e.g., possible to compute the solution of a linear system of differential equations

der(x) = A*x   ->   x(t0 + T) = e^(AT)*x(t0)

Algorithmic details

The algorithm is taken from

H. D. Joos, G. Grübel:
RASP'91 Regulator Analysis and Synthesis Programs
DLR - Control Systems Group 1991

The following steps are performed to calculate the exponential of A:

  1. Matrix A is balanced
    (= is transformed with a diagonal matrix D, such that inv(D)*A*D has a smaller condition as A).
  2. The scalar T is divided by a multiple of 2 such that norm( inv(D)*A*D*T/2^k ) < 0.5. Note, that (1) and (2) are implemented such that no round-off errors are introduced.
  3. The matrix from (2) is approximated by explicitly performing the Taylor series expansion with a variable number of terms. Truncation occurs if a new term does no longer contribute to the value of Φ from the previous iteration.
  4. The resulting matrix is transformed back, by reverting the steps of (2) and (1).

In several sources it is not recommended to use Taylor series expansion to calculate the exponential of a matrix, such as in 'C.B. Moler and C.F. Van Loan: Nineteen dubious ways to compute the exponential of a matrix. SIAM Review 20, pp. 801-836, 1979' or in the documentation of m-file expm2 in MATLAB version 6 (http://www.mathworks.com) where it is stated that 'As a practical numerical method, this is often slow and inaccurate'. These statements are valid for a direct implementation of the Taylor series expansion, but not for the implementation variant used in this function.


phi = exp(A, T)

Inputs (2)


Type: Real[:,size(A, 1)]


Default Value: 1

Type: Real

Outputs (1)


Type: Real[size(A, 1),size(A, 1)]

Description: = exp(A*T)


Release Notes:

  • July 5, 2002 by H. D. Joos and Nico Walther