# # Phase portraits for systems of linear DEs (given by their matrix) # with eigenvalues of the form: # imaginary w/ Real part negative # repeated positive # distinct, real, positive # real, negative # real, 1 positive, 1 negative # > restart;with(DEtools):with(linalg):with(plots): Warning: new definition for norm Warning: new definition for trace # Here, the eigenvalues are negative imaginary, so we get a spiral # sink. > A := linalg[matrix](2,2,[a,b,c,d]): > a := 0: b := -2: c := 1: d := -2: > eigenvals(A); eigenvects(A,radical); - 1 + I, - 1 - I [- 1 + I, 1, {[ 1, 1/2 - 1/2 I ]}], [- 1 - I, 1, {[ 1, 1/2 + 1/2 I ]}] > > phaseportrait(A,[x,y],-4..1,{[0,1,0],[0,0,1],[0,0,-1],[0,-1,0],[0,-5,5],[0,5,-5]},stepsize=.2,x=-10..10,y=-10..10,title=`spiral sink`,arrows=THICK); > exponential(A*t); [ exp(- t) cos(t) + exp(- t) sin(t) - 2 exp(- t) sin(t) ] [ ] [ exp(- t) sin(t) exp(- t) cos(t) - exp(- t) sin(t) ] # Here, the eigenvalues are positive repeated, so everything # comes along one vector. > B := linalg[matrix](2,2,[e,f,g,h]):\ e := 4: f:= 6: g := 0: h := 4:\ phaseportrait(B,[x,y],-4..1,{[0,1,0],[0,0,1],[0,0,-1],[0,-1,0],[0,-5,5],[0,5,-5],[0,-1,8],[0,1,-8]},stepsize=.2,x=-10..10,y=-10..10,title=`repeated root`,arrows=THICK);\ \ > eigenvals(B); eigenvects(B,radical);\ 4, 4 [4, 2, {[ 1, 0 ]}] # Here, the eigenvalues are real and positive (unstable node) > exponential(B*t); > J:=jordan(B,P); > Q:=evalm(1/P); [ 6 1 ] Q := [ ] [ 0 1 ] [ 4 1 ] J := [ ] [ 0 4 ] [ exp(4 t) 6 t exp(4 t) ] [ ] [ 0 exp(4 t) ] > A1:= linalg[matrix](2,2,[a1,b1,c1,d1]): > a1 := -1: b1 := 2: c1 := -7: d1 := 8: > eigenvals(A1);eigenvects(A1,radical); 6, 1 [6, 1, {[ 1, 7/2 ]}], [1, 1, {[ 1, 1 ]}] > sol:=c3*exp(6*t)*matrix(2,1,[1,1])+c2*exp(1*t)*matrix(2,1,[1,7/2]); [ 1 ] [ 1 ] sol := c3 exp(6 t) [ ] + c2 exp(t) [ ] [ 1 ] [ 7/2 ] > exponential(A1*t); [ 7/5 exp(t) - 2/5 exp(6 t) 2/5 exp(6 t) - 2/5 exp(t) ] [ ] [ - 7/5 exp(6 t) + 7/5 exp(t) - 2/5 exp(t) + 7/5 exp(6 t) ] > c3:=1; c2:=2; sol1:=evalm(sol); c3 := 1 c2 := 2 [ exp(6 t) + 2 exp(t) ] sol1 := [ ] [ exp(6 t) + 7 exp(t) ] > x1:=sol1[1,1]; x2:=sol1[2,1]; x1 := exp(6 t) + 2 exp(t) x2 := exp(6 t) + 7 exp(t) > plot(x1, t=0..5); > plot(x2, t=0..5); > phaseportrait(A1,[x,y],-4..1,{[0,1,0],[0,0,1],[0,0,-1],[0,-1,0],[0,-5,5],[0,5,-5]},stepsize=.2,x=-10..10,y=-10..10,title=`improper node`,arrows=THICK); # Here, the eigenvalues are real and negative (stable node) > > restart; with(DEtools):with(linalg): Error, too many files simultaneously open for reading Warning: new definition for norm Warning: new definition for trace > A := linalg[matrix](2,2,[a,b,c,d]): > > a := -3: b := 1: c := 0: d := -2: > eigenvals(A);eigenvects(A,radical); -3, -2 [-3, 1, {[ 1, 0 ]}], [-2, 1, {[ 1, 1 ]}] > phaseportrait(A,[x,y],-4..1,{[0,1,0],[0,0,1],[0,0,-1],[0,-1,0],[0,-5,5],[0,5,-5]},stepsize=.2,x=-10..10,y=-10..10,title=`improper node`,arrows=THICK); # Here, the eigenvalues are one pos, one neg (an unstable saddle) # > > A3 := linalg[matrix](2,2,[a3,b3,c3,d3]): > a3 := 1: b3 := 2: c3 := 3: d3 := 2: > eigenvals(A3);eigenvects(A,radical); 4, -1 [-3, 1, {[ 1, 0 ]}], [-2, 1, {[ 1, 1 ]}] > phaseportrait(A3,[x,y],-4..1,{[0,1,0],[0,0,1],[0,0,-1],[0,-1,0],[0,-5,5],[0,5,-5]},stepsize=.2,x=-10..10,y=-10..10,title=`saddle`,arrows=THICK);