ODEs - Phase Plane/Portrait 

 

We begin by clearing memory and loading the linear algebra and differential 

equations packages. 

> restart; 1; with(DEtools); -1; with(LinearAlgebra); -1
 

Warning, the assigned name RationalCanonicalForm now has a global binding 

 

The phase plane of the system: 

(Section 7.5 #4) 

 

(D(x[1]))(t) = x[1](t)+x[2](t) 

(D(x[2]))(t) = 4*x[1](t)-2*x[2](t) 

 

> Eqns1 := {diff(x[1](t), t) = x[1](t)+x[2](t), diff(x[2](t), t) = 4*x[1](t)-2*x[2](t)}; 1
 

(Typesetting:-mprintslash)([Eqns1 := {diff(x[1](t), t) = x[1](t)+x[2](t), diff(x[2](t), t) = 4*x[1](t)-2*x[2](t)}], [{diff(x[1](t), t) = x[1](t)+x[2](t), diff(x[2](t), t) = 4*x[1](t)-2*x[2](t)}]) 

> A1 := Matrix([[1, 1], [4, -2]]); 1
 

(Typesetting:-mprintslash)([A1 := Matrix([[1, 1], [4, -2]])], [Matrix(%id = 148840964)]) 

> Eigenvectors(A1); 1
 

(Typesetting:-mprintslash)([Vector[column]([[2], [-3]]), Matrix([[1, (-1)/4], [1, 1]])], [Vector[column](%id = 147640072), Matrix(%id = 149815460)]) 

 

Direction field along with sample trajectories along eigenvector directions... 

 

> phaseportrait(Eqns1, {x[1](t), x[2](t)}, t = -1 .. 1, {[x[1](0) = (-1)/4, x[2](0) = 1], [x[1](0) = 1, x[2](0) = 1], [x[1](0) = 1/4, x[2](0) = -1], [x[1](0) = -1, x[2](0) = -1]}); 1
phaseportrait(Eqns1, {x[1](t), x[2](t)}, t = -1 .. 1, {[x[1](0) = (-1)/4, x[2](0) = 1], [x[1](0) = 1, x[2](0) = 1], [x[1](0) = 1/4, x[2](0) = -1], [x[1](0) = -1, x[2](0) = -1]}); 1
phaseportrait(Eqns1, {x[1](t), x[2](t)}, t = -1 .. 1, {[x[1](0) = (-1)/4, x[2](0) = 1], [x[1](0) = 1, x[2](0) = 1], [x[1](0) = 1/4, x[2](0) = -1], [x[1](0) = -1, x[2](0) = -1]}); 1
 

Plot 

 

We have an unstable saddle point at the origin. 

 

Here are a few more sample trajectories... 

 

> phaseportrait(Eqns1, {x[1](t), x[2](t)}, t = -1 .. 1, {[x[1](0) = -5, x[2](0) = 0], [x[1](0) = 1, x[2](0) = 5], [x[1](0) = 5, x[2](0) = 0], [x[1](0) = -1, x[2](0) = -5]}); 1
phaseportrait(Eqns1, {x[1](t), x[2](t)}, t = -1 .. 1, {[x[1](0) = -5, x[2](0) = 0], [x[1](0) = 1, x[2](0) = 5], [x[1](0) = 5, x[2](0) = 0], [x[1](0) = -1, x[2](0) = -5]}); 1
phaseportrait(Eqns1, {x[1](t), x[2](t)}, t = -1 .. 1, {[x[1](0) = -5, x[2](0) = 0], [x[1](0) = 1, x[2](0) = 5], [x[1](0) = 5, x[2](0) = 0], [x[1](0) = -1, x[2](0) = -5]}); 1
 

Plot 

 

The phase plane of the system: 

(Section 7.6 #4) 

 

(D(x[1]))(t) = 2*x[1](t)-5/2*x[2](t) 

(D(x[2]))(t) = 9/5*x[1](t)-x[2](t) 

 

> Eqns2 := {diff(x[1](t), t) = 2*x[1](t)-5/2*x[2](t), diff(x[2](t), t) = 9/5*x[1](t)-x[2](t)}; 1
Eqns2 := {diff(x[1](t), t) = 2*x[1](t)-5/2*x[2](t), diff(x[2](t), t) = 9/5*x[1](t)-x[2](t)}; 1
 

(Typesetting:-mprintslash)([Eqns2 := {diff(x[1](t), t) = 2*x[1](t)-5/2*x[2](t), diff(x[2](t), t) = 9/5*x[1](t)-x[2](t)}], [{diff(x[1](t), t) = 2*x[1](t)-5/2*x[2](t), diff(x[2](t), t) = 9/5*x[1](t)-x[2... 

> A2 := Matrix([[2, (-5)/2], [9/5, -1]]); 1
 

(Typesetting:-mprintslash)([A2 := Matrix([[2, (-5)/2], [9/5, -1]])], [Matrix(%id = 150102312)]) 

> Eigenvectors(A2); 1
 

(Typesetting:-mprintslash)([Vector[column]([[1/2+3/2*I], [1/2-3/2*I]]), Matrix([[5/6+5/6*I, 5/6-5/6*I], [1, 1]])], [Vector[column](%id = 145144724), Matrix(%id = 151592984)]) 

 

The direction field along with a few sample trajectories... 

 

> phaseportrait(Eqns2, {x[1](t), x[2](t)}, t = -10 .. 1, {[x[1](0) = -1, x[2](0) = 1], [x[1](0) = 1, x[2](0) = 1], [x[1](0) = 1, x[2](0) = -1], [x[1](0) = -1, x[2](0) = -1]}, stepsize = .1); 1
phaseportrait(Eqns2, {x[1](t), x[2](t)}, t = -10 .. 1, {[x[1](0) = -1, x[2](0) = 1], [x[1](0) = 1, x[2](0) = 1], [x[1](0) = 1, x[2](0) = -1], [x[1](0) = -1, x[2](0) = -1]}, stepsize = .1); 1
phaseportrait(Eqns2, {x[1](t), x[2](t)}, t = -10 .. 1, {[x[1](0) = -1, x[2](0) = 1], [x[1](0) = 1, x[2](0) = 1], [x[1](0) = 1, x[2](0) = -1], [x[1](0) = -1, x[2](0) = -1]}, stepsize = .1); 1
 

Plot 

 

We have an unstable spiral point at the origin.