Solving Systems of Equations in Maple The Solve Command Matrix

Solving Systems of Equations in Maple
Dave Murrin, November, 2007
The Solve Command
Maple can solve systems of equations using the solve command. The equations listed within the
command are enclosed by curly brackets. The variables to be solved are also enclosed in curly brackets.
As an example:
> solve({3*x+5=y,7*x+9*y=14},{x,y});
Matrix Methods
Command Packages Needed :
> restart; with(linalg);
Warning, the protected names norm and trace have been redefined and unprotected
___________________________________________________________________________________
Solving Linear Systems
___________________________________________________________________________________
A linear system is a collection of first degree equations. A solution to a system consists of one or more
sets of specific values that are common solutions to each of the individual equations. Here is a simple
example which we can solve quite easily using the solve command.
> sys := { 3*x + 5*y + 2*z = 12, 2*x + 5*y - 4*z = 9,
4*x - y + 5*z = -3};
> solve( sys, {x,y,z});
Remember, if you need to enter multiple lines at a single command prompt, type return (Macintosh)
rather than enter, or shift-return (Window) rather than return.
Maple will automatically use fractions. However, you can force decimal answers using the evalf
command.
> evalf(%);
AUTOMATIC MATRIX SOLUTION
We can also convert this system of equations to a matrix system.
> eqns := {3*x+5*y+2*z = 12, 2*x+5*y-4*z = 9, 4*x-y+5*z = -3}
{ 3 x C 5 y C 2 z = 12 , 2 x C 5 y K 4 z = 9, 4 x K y C 5 z = K3 }
> A := genmatrix(eqns, [x, y, z])
é3 5
2 ù
ê
ú
ê 2 5 K4 ú
ê
ú
4
K1
5
ë
û
> b := vector([12, 9, -3])
[ 12
9 K3 ]
A matrix method can be solved using a different command, the linsolve command.
> x := linsolve(A, b)
é K33
ê 37
ë
99
37
24 ù
37 úû
This is useful if you start with a matrix equation to begin with.