(%i1) | kill(all)$ |
(%i1) | load(eigen)$ |
module 1:intro how to solve system : differential equations. , intro
[email protected] , 24/03/2017
IVP = initial value problem : first order differential equation.
-----------------------------------------------------------------
-----------------------------------------------------------------
menu → Equations → Solve ODE ⇒ 'ode2'
-----------------------------------------------------------------
-----------------------------------------------------------------
dx/dt = 2*x
start(= initial) value = x(t=0)= x0 *,' t=0 or t=t0 '
solution : x(t) = x0 e^(2*t)
-----------------------------------------------------------------
rem :( 2 = variable - > a), use 'assume' statement
p1: dx/dt = a * x;
assume( a>0);
-----------------------------------------------------------------
-----------------------------------------------------------------
(%i2) | p1:ode2('diff(x,t)=2*x,x,t); |
use * 'see above'
(%i3) | p2:ev(p1,%c=x0,t=0); |
rem : part(p2,1) → x
part(p2,2) → x0
solution : differential equations < 'diff(x,t)=2*x >
(%i4) | p3:ev(p1,%c=part(p2,2)); |
<system of differential equations>.
'2' ( e^(2*t)) will be changed in 'matrix' ( e^(matrix*t))
1e row matrix → first differential equation
2e row matrix → second differential equation
.......................... etc
system : vector 1 = matrix * vector 2
first example :( matrix = '2 by 2' ) system of differential equations. 'intro'
----------------------------------------------------------------------
----------------------------------------------------------------------
first part ⇒ : principles
1e) find : eigenvalues.
2e) find : eigenvector.
second part ⇒ : build matrix 'eigenvectors' ( example ' 3 by 3 ' matrix )
1e) build matrix
2e) find : invers of the build matrix
third part ⇒ : build exponential matrix ' see above '
rem: < characteristic polynomial >,<unit eigenvectors>
rem : < multiplicities > ' eigenvalues '
first part ⇒
principles '2 by 2' ,'3 by 3'
(%i5) | kill(all); |
(%i2) |
ps1:'diff(x[1],t)=-1/2*x[1]+x[2]; ps2:'diff(x[2],t)=0*x[1]-2*x[2]; |
(%i3) | p4: matrix ([-.5, 1], [0, -2]); |
calculation : eigenvalues '2 by 2' matrix
(%i4) | p5:eigenvalues(p4); |
(%i6) |
p6:lambda[1]=part(p5,1,1); p7:lambda[2]=part(p5,1,2); |
calculation : eigenvector '2 by 2' matrix
(%i7) | p8:eigenvectors(p4); |
(%i9) |
p9:p8[2][1][1]; p10:p8[2][2][1]; |
(%i10) | p11:matrix([1,3,2],[3,-5,6],[2,6,4]); |
(%i11) | p12:eigenvectors(p11); |
three eigenvectors '3 by 3' matrix ' p11 '
1e part : p12 'eigenvalues'
p13 ' eigenvalues '
p14 ' multiplicities of the eigenvalues '
(%i13) |
p13:p12[1][1]; p14:p12[1][2]; |
2e part : p15,p16,p17 'eigenvectors'
(%i16) |
p15:p12[2][1][1]; p16:p12[2][2][1]; p17:p12[2][3][1]; |
second part ⇒
1e) build matrix 'eigenvectors'
(%i17) | p18:transpose(matrix(p15,p16,p17)); |
2e) find : invers of the build matrix 'p18'
(%i18) | p19:invert(p18); |
third part ⇒
build exponential matrix = p22 ' see above ',use p13
(%i19) | p21:diagmatrix(3,1); |
(%i20) |
for i:1 thru 3 do p21[i][i]:exp^(float(p13[i])*t); |
(%i21) | p22:p21; |
(%i22) | p23:float(p18*p22*p19); |
rem : < characteristic polynomial > , p11 ⇒ find ' lambda=eigenvalues '
statement 'charpoly(matrix)'
(%i23) | p24:factor(charpoly(p11,lambda)); |
(%i24) | p25:allroots(p24); |
the three values :' same : from p13 '
(%i27) |
p26:p25[1]; p27:p25[2]; p28:p25[3]; |
'number' of eigenvalues ⇒ same as dimension of the ( 'matrix' = ' 3 by 3 ') = 3
see : p25
<unit eigenvectors from matrix> 'p11'
statement 'uniteigenvectors(matrix)'
(%i28) | p29:float(uniteigenvectors(p11)); |
rem : < multiplicities > ' eigenvalues '
(%i29) | M1 : matrix ([3,0,0,0], [0,2,0,0],[0,0,3,0],[0,0,0,1]); |
(%i30) | [vals, vecs] : eigenvectors (M1); |
1e) vals ⇒ eigenvalues : same 'eigenvalues'
-----------------------------------------------------
first part ' vals ' = values
second part ' vals ' = multiplicities from first part
example : value = 3, 2 times .
example : sum part 2 = dimension of matrix = 1+1+2=4 'M1'
' 4 by 4 '
-----------------------------------------------------
2e) vecs ⇒ eigenvectors
(%i32) |
vals; vecs; |
module 1:
statements: ode2,uniteigenvectors,eigenvalues,charpoly,diagmatrix,invert,matrix,allroots,transpose.
new construction 'statement': '[vals, vecs] : eigenvectors (M1);'