Maple Lab • Linear Algebra & ODE
Matrices, eigenvalues, systems, and differential equationsThis track shows how Maple can support matrix computations, eigenvalue problems, and ordinary differential equations, including simple systems and phase portraits.
The LinearAlgebra package turns many pages of algebra into a few commands.
Always start by loading it:
with(LinearAlgebra):
Basic objects:
A := Matrix([[1,2],[3,4]]);b := Vector([5,6]);A . b;(matrix–vector product)
with(LinearAlgebra):
A := Matrix([[2,1],[1,3]]);
b := Vector([5,7]);
x := LinearSolve(A, b);
Compare this with solving the same system by hand. Maple’s answer can be written in vector form or as separate coordinates.
Eigenvalues and eigenvectors show how a matrix stretches space. Maple can compute them quickly:
Eigenvalues(A);Eigenvectors(A);
with(LinearAlgebra):
A := Matrix([[4,1],[2,3]]);
Eigenvalues(A);
Eigenvectors(A);
After computing these in Maple, try computing the characteristic polynomial by hand, then check that Maple’s eigenvalues match your calculation.
with(LinearAlgebra):
A := Matrix([[2,1],[0,2]]);
P, J := JordanForm(A, output = ['P','J']);
This is more advanced but can appear in higher-level courses or projects linked with dynamics.
Maple’s dsolve command covers many textbook differential equations:
- First-order separable, linear, exact equations.
- Second-order equations with constant coefficients.
- Systems of first-order equations.
de := diff(y(x), x) + y(x) = exp(-x);
dsolve(de, y(x));
Example: with an initial condition
de_ic := { diff(y(x), x) + y(x) = exp(-x), y(0) = 2 };
dsolve(de_ic, y(x));
The DEtools package contains DEplot, which you can use to
plot solution curves and slope fields.
with(DEtools):
de := diff(y(x), x) = x - y(x);
DEplot(de, y(x), x = -2..2, y = -4..4);
with(DEtools):
de := diff(y(x), x) = y(x);
DEplot(de, y(x), x = -2..2, y = -3..3,
arrows = medium,
linecolor = black);
In tutorials, you can compare this to sketches students make by hand for the same equation.
Linear algebra and ODEs meet when you study systems like x'(t) = A x(t).
Maple lets you explore this bridge explicitly.
System: x'(t) = Ax
For a 2×2 matrix with distinct eigenvalues:
with(LinearAlgebra):
A := Matrix([[1,2],[-2,1]]);
Eigenvalues(A);
Solution form
Write the system as:
de := { diff(x1(t),t) = 1*x1(t) + 2*x2(t),
diff(x2(t),t) = -2*x1(t) + 1*x2(t) };
Then ask Maple for dsolve with initial conditions.
Once students are comfortable with DEplot, you can invite them to:
- • Classify equilibria of simple 2D systems by looking at eigenvalues of the matrix.
- • Compare hand-drawn phase portraits to Maple plots.
- • Explore how changing a parameter in the matrix affects trajectories.
When running a Maple–linear algebra or Maple–ODE lab:
- • Start with a matrix or ODE that already appeared in lectures.
- • Show how Maple confirms the result.
- • Then choose a slightly more complicated example that is easier in Maple than by hand.
The goal is that students see Maple as a partner: a way to test linear algebra and ODE ideas, not a black box.