> | with(LinearAlgebra):with(plots):with(DEtools): |
Warning, the name changecoords has been redefined
Separation/Inhomogeneous
> | A:=Matrix([[3,-1],[-2,4]]); |
> | de1:=diff(x1(t),t)=3*x1(t)-x2(t)+6; |
> | de2:=diff(x2(t),t)=-2*x1(t)+4*x2(t)+12; |
> | dsolve({de1,de2}); |
> | dfieldplot([de1,de2],[x1(t),x2(t)],t=0..1,x1=-8..2,x2=-8..2,arrows=MEDIUM); |
> |
Inhomogeneous, nonautonomous
> | A:=Matrix([[1,1],[4,1]]); |
> | E:=Eigenvectors(A); |
> | M:=Matrix([[-1,1],[2,2]]); |
> | C:=Matrix([[-1,0],[0,3]]); |
> | M.C.M^(-1); |
> | g1(t):=exp(2*t);g2(t):=sin(t); |
> | de1:=diff(x1(t),t)=x1(t)+x2(t)+g1(t); |
> | de2:=diff(x2(t),t)=4*x1(t)+x2(t)+g2(t); |
> | gv:=Matrix([[g1(t)],[g2(t)]]); |
> | h:=M^(-1).gv; |
> | h[1,1]; |
> | den1:=diff(y1(t),t)=-y1(t)+h[1,1]; |
> | den2:=diff(y2(t),t)=3*y2(t)+h[2,1]; |
> | sol:=dsolve({den1,den2}); |
> | y1s:=solve(sol[2],y1(t)); |
> | y2s:=solve(sol[1],y2(t)); |
> | xsol:=M.Matrix([[y1s],[y2s]]); |
> | r:=A.xsol+gv; |
> | expand(r[1,1]); |
> | expand(diff(xsol[1,1],t)); |
> | expand(r[2,1]); |
> | expand(diff(xsol[2,1],t)); |
> |
Higher Dimensional Eigenspaces
> | A:=Matrix([[3,-18,-4,39,20],[0,11,2,-20,-10],[0,9,4,-20,-10],[0,-18,-4,42,20],[0,45,10,-100,-48]]); |
> | c:=CharacteristicPolynomial(A,x); |
> | solve(c,x); |
> | M:=Matrix([[0,1,0,1,0],[-2/9,20/9,10/9,0,1/5],[1,0,0,0,1/5],[0,1,0,0,-2/5],[0,0,1,0,1]]); |
> | M^(-1).A.M; |
> | gv:=Matrix([[cos(t)],[sin(t)],[exp(5*t)],[exp(2*t)],[t*exp(2*t)]]); |
> | h:=M^(-1).gv; |
> | de1:=diff(y1(t),t)=2*y1(t)+h[1,1]; |
> | de2:=diff(y2(t),t)=2*y2(t)+h[2,1]; |
> | de3:=diff(y3(t),t)=2*y1(t)+h[3,1]; |
> | de4:=diff(y4(t),t)=3*y4(t)+h[4,1]; |
> | de5:=diff(y5(t),t)=3*y1(t)+h[5,1]; |
> | sol:=dsolve({de1,de2,de3,de4,de5}); |
> | yv:=Matrix([[solve(sol[1],y1(t))],[solve(sol[3],y2(t))],[solve(sol[5],y3(t))],[solve(sol[2],y4(t))],[solve(sol[4],y5(t))]]); |
> | xsol:=M.yv; |
> | r:=A.xsol+gv: |
> | r[1,1]; |
> | diff(xsol[1,1],t); |
> |
> |
> |