Linear Algebra with Sage

<Matrix Exponential>

Made by SKKU Linear Algebra Lab (2011)

Find a matrix exponential $e^{A}$ using $e^{A}=e^{QDQ^{-1}}=Qe^{D}Q^{-1}$. (Compare $e^{A}$ and $e^{D}$)

Define a matrix $A$. (행렬$A$ 생성 및 확인)

 A=matrix([[-2,0,0,0],[0,-2,5,-5],[0,0,3,0],[0,0,0,3]]); A

[-2  0  0  0]

[ 0 -2  5 -5]

[ 0  0  3  0]

[ 0  0  0  3]

Find eigenvectors of $A$. ($A$의 고유벡터를 구한다.)

 ev=A.eigenvectors_right(); ev

[(3, [(0, 1, 0, -1),(0, 0, 1, 1)], 2), (-2, [(1, 0, 0, 0),(0, 1, 0, 0)], 2)]

Find a matrix $Q$ and its inverse. (행렬 $A$를 대각화하는 행렬 $Q$를 구하고 그 역행렬을 구한다.)

 Q=matrix([ev[0][1][0],ev[0][1][1],ev[1][1][0],ev[1][1][1]]).transpose(); QI=Q.inverse(); Q, QI

(

[ 0  0  1  0]  [ 0  0  1 -1]

[ 1  0  0  1]  [ 0  0  1  0]

[ 0  1  0  0]  [ 1  0  0  0]

[-1  1  0  0], [ 0  1 -1  1]

)

Diagonalize matrix $A$. (행렬 $A$를 대각화한다.)

 D=QI*A*Q; D

[ 3  0  0  0]

[ 0  3  0  0]

[ 0  0 -2  0]

[ 0  0  0 -2]

Find $e^{D}$. ($e^{D}$를 구한다.)

 ED=diagonal_matrix([e^3,e^3,e^(-2),e^(-2)]); ED

[   e^3      0      0      0]

[     0    e^3      0      0]

[     0      0 e^(-2)      0]

[     0      0      0 e^(-2)]

Find $e^{A}$. ($e^{A}=e^{QDQ^{-1}}=Qe^{D}Q^{-1}$를 이용하여 $e^{A}$를 구한다.)

 Q*ED*QI

[       e^(-2)             0             0             0]

[            0        e^(-2) -e^(-2) + e^3  e^(-2) - e^3]

[            0             0           e^3             0]

[            0             0             0           e^3]