MTH215/URI
Fall 2004
Matrix Exponential
Worksheet by M. R. S. Kulenovic, URI, Fall 2004
Goals
Goals of this worksheet:
Use eigenvectors and eigenvalues to simplify computation of a matrix exponential.
Find the solution of homogeneous and nonhomogeneous linear system of differential equations.
> | restart:with(plots):with(linalg): |
Warning, the name changecoords has been redefined
Warning, the protected names norm and trace have been redefined and unprotected
Matrix Exponential
The MatrixExponential(A, t) command returns the Matrix exp(A*t) = I + A*t + 1/2!*A^2*t^2 + ... where I is the identity Matrix. This is an example of a generalized Matrix function , F(A).
If the scalar parameter t is not specified, the first indeterminate value in the Matrix is removed and used as a parameter.
For more information on the output options outopts, see Matrix .
Examples
Example 1.
> | with(LinearAlgebra):
A := Matrix([[-5, -9], [6, 10]]); |
> | MatrixExponential(A); |
> | MatrixExponential(A, x); |
Example 2.
> | B := Matrix([[-39, -38, -92], [4, 3,8],[18,18,43]]); |
> | MatrixExponential(B); |
> | MatrixExponential(B, x); |
> |
Exercise:
Finding the solutions of the system of differential equations.
Example 1.
> | restart;with(LinearAlgebra):with(linalg): |
Warning, the previous binding of the name GramSchmidt has been removed and it now has an assigned value
Warning, the protected names norm and trace have been redefined and unprotected
Lets try the following example:
The matrix A is given by
> | A:=array([[10,6],[-9,-5]]); |
Here is the nonhomogeneous term g(t)
> | g:=t->array([[2*t^2+1],[4*t]]); |
And finally an intial condition
> | x0:=array([[2],[4]]); |
Here is the fundamental matrix of our problem Phi(t) = Exp(A*t):
> | phi:=t->exponential(A*t); |
> | phi(t); |
First we will get the general solution of the homogeneous equation
> | xh := t -> phi(t)&*x0; |
Then the particular solution using the map command
> | xp := t -> map(integrate,evalm(phi(-z)&*g(z)),z=0..t); |
And then the general solution of the problem:
> | xnonh := t -> evalm(xh(t) + xp(t)); |
After simplification we obtain:
> | simplify(evalm(xnonh(t))); |
A simple check of the initial condition...
> | check := evalf(evalm(xnonh(1e-16))); |
Example 2.
> | restart;with(LinearAlgebra):with(linalg): |
Here we will use Matrix Exponential to find the solution of homogeneous and nonhomogeneous linear system of differential equations. Our principal tool is the variation of parameters formula for linear system of differential equations:
X'(t) = A X(t) + b(t)
that satisfies initial condition:
X(0) = c.
The solution of this initial value problem is given as the sum of the general solution of the corresponding homogeneous problem Xh(t) and the particular solution of nonhomogeneous system Xp(t):
X(t) = Xh(t) + Xp(t) = exp(At) X(0) + exp(At) int(exp(-As) b(s), 0, t).
> | X(t) = exp(A*t)*X(0) + exp(A*t)*Int(exp(-A*s)*b(s),s=0..t); |
Lets try the following example:
The matrix A is given by
> | B:=array([[-6,-10,4],[2,3,-2],[-3,-6,1]]); |
Here is the nonhomogeneous term g(t)
> | g:=t->array([[2*t^2+exp(t)],[4*sin(t)+1],[t+cos(t)]]); |
An intial condition
> | x0:=array([[2],[4],[-1]]); |
Here is the fundamental matrix of our problem Phi(t) = Exp(A*t):
> | phi:=t->exponential(B*t); |
> | phi(t); |
First we will get the general solution of the homogeneous equation
> | xh := t -> phi(t)&*x0; |
Then the particular solution using the map command
> | xp := t -> map(integrate,evalm(phi(-z)&*g(z)),z=0..t); |
And then the general solution of the nonhomogeneous equation:
> | xnonh := t -> evalm(xh(t) + xp(t)); |
After simplification we obtain:
> | simplify(evalm(xnonh(t))); |
A simple check of the initial condition...
> | check := evalf(evalm(xnonh(1e-16))); |
> |