Systems of Differential Equations
The system
[ 1 1 ]
U' = [ ] . U
[ 4 1 ]
can be entered as
plotdf -ode { D(x,t) = x + y;
D(y,t) = 4*x+ y
} -xradius 4
When you click at a point say
[x,y] = [1,2]
then
you are finding the trajectory through that point. Note in the above
plot the special directions corresponding to the eigenvectors of the
matrix.
We can calculate the eigenvalues by solving the characteristic equation:
solve((determinant(matrix([1,1],[4,1]) - r*ident(2)))) returns
[R = 3, R = - 1]
If the eigenvalues are complex we have a different situation:
plotdf -ode { D(x,t) = x + -y;
D(y,t) = 4*x+ y
}
solve(determinant(matrix([1,-1],[4,1]) - r*ident(2))) returns
[R = 1 - 2 %I, R = 2 %I + 1]
Why does the curve rotate in the positive direction?
plotdf -ode { D(x,t) = x + y;
D(y,t) = -4*x + y
} -xradius 4
An almost linear system:
plotdf -ode { D(x,t) = 1 - x*y;
D(y,t) = x -y**3
} -xradius 2 -yradius 2
Comparing two methods of looking at the system
D[x,t]= y, D[y,t]= -sin(x) - 0.1* y
First we look at the trajectory through the point (x,y) = (0,3).
If you follow the trajectory it eventually seems to circle around the
point (0,13).
plotdf -ode { D(x,t)= y;
D(y,t)= -sin(x) - 0.1* y} -xcenter 8 -xradius 8 \
-ycenter 3 -yradius 8
If we look at the same equation with the same inital conditions
(0,3) (in fortran notation!), then we see the 'line 1' (representing 'x')
tending to 13 and the 'line 2' representing 'y' tending to 0.
function xdot = pend(x,t)
xdot(1) = x(2); xdot(2) = -sin( x(1)) - 0.1*x(2); end
sol=lsode( "pend",[0.0, 3.0], t = linspace(0,40, 200));
plot( t, sol);
Tools for Computation of eigenvalues and eigenvectors
Two useful functions in maxima are:
- EIGENVALUES(MAT) takes a MATRIX as its argument and
returns a list of lists the first sublist of which is the list of
eigenvalues of the matrix and the other sublist of which is the list
of the multiplicities of the eigenvalues in the corresponding order.
- EIGENVECTORS (MAT) takes a MATRIX as its argument and
returns a list of lists the first sublist of which is the output of
the EIGENVALUES command and the other sublists of which are the
eigenvectors of the matrix corresponding to those eigenvalues
respectively.
eigenvectors(matrix([1,-1],[4,1]))
yields
[[[1 - 2 %I, 2 %I + 1], [1, 1]], [1, 2 %I], [1, - 2 %I]]
so the eigenvalues are [3,-1] with multiplicities 1 and 1 respectively, and the
corresponding eigenvectors are [1,2] and [1,-2].
eigenvectors(matrix([2,1,2],[0,2,3],[0,0,4]));
returns
6 4
[[[2, 4], [2, 1]], [1, 0, 0], [1, -, -]]
7 7
You may also use octave to compute eigenvalues. The function eig
will return either just the list of eigenvalues, or else can return
the eigen vectors and the eigenvalues:
[vecs,diag] = eig (m=[2,1,2;4,2,3;7,0,4])
yields
Result
Thus the vecs is set to the
3x3 matrix whose columns are the eigenvectors
and the matrix diag becomes the diagonalization of m.
The following identity should hold. Note that in octave
vecs(:,i) picks out the ith column.
m*vecs(:,i) = diag(i,i)*vecs(:,i)