Systems of Equations and Determinants with Maple
Copyright © 2002, 2003 by James F. Hurley, University of Connecticut Department of Mathematics, 196 Audtiorium Road Unit 3009, Storrs CT 06269-3009. All rights reserved.
The Department's Macintosh Computing Laboratory has a short document to get going with Maple, and both Maple's
are available for you to consult. This computer algebra system (CAS) can carry out symbolic computation, as well as numerical and graphical calculations. The
provides basic information about syntax and includes many illustrative examples, although few above the level of calculus.
Maple has two linear algebra packages: LinearAlgebra , which contains approximately 75 routines designed primarily for numerical computations and the older linalg , which contains more than 100 routines for both symbolic and numerical computation. To access either package within a Maple worksheet, use the with command. For example,
The colon suppresses display of all the routines in the package. (Replace the colon by a semicolon to see that list. Alternatively, open the
and then type in
. Note that the
menu also offers
New User's Tour
, which you may want to take for a quick introduction.)
1. Systems of linear equations in matrix-vector form. A system of n linear equations in n real variables , , ..., is conveniently expressible as a vector equation
+ + للل + = b,
of coefficients from the equations. For instance, consider a system of three equations in three variables. The following Maple code illustrates how to specify a list of such equations and have Maple work with it in the matrix-vector form
matrix of coefficients,
is the vector of variables and
is the vector of constants on the right side of the equations. The equations in question come from Exercise 14 of Section 4.1 of Florin Diacu,
Differential Equations/Order and Chaos
, Freeman, 2000. Execute the routine and note the results. (Recall that to execute a block of code, place the cursor at the end of the code and press Enter.)
sys := [ x - x + x = 1,
x + x - x = 1,
-x + x + x = 1 ];
var := [ x, x, x ]:
(A,b) := GenerateMatrix(sys, var);
Note that the column vectors are of the form
where the numbers
are the coefficents of the
th variable in equation
= 1, 2, 3..
We can also reverse the above process, and specify a system of linear equations A x = b by giving the matrix A , the vector x of variables, and the vector b of constants. The next Maple routine illustrates that with the 3-by-4 augmented matrix of coefficients P = [ A b ] for the same system..
P := Matrix( 3, 4, [ [1, -1, 1, 1], [1, 1, -1, 1], [-1, 1, 1, 1] ] );
GenerateEquations( P, [x, x, x] );
We can also ask Maple to form the matrix-vector product A x directly, as the following illustrates. To avoid inadertent use of an already defined symbol, use the restart: command. (Note that Maple's notation for multiplying an n -vector x on the left by an m -by- n matrix A is A.x . As execution of the following short routine illustrates, in the LinearAlgebra package, you can also use Multiply(A, X) ).
A := Matrix(3, 3, [[1, -1, 1],[1, 1, -1], [-1, 1, 1]] );
X := Matrix(3, 1, [ [`x`], [`x`], [`x`] ]);
Prod := Multiply(A, X);
Prod = <1, 1, 1>;
Prod2 = <1, 1, 1>;
2. Determinants . The misprints in Diacu's discussion of determinant make it of interest to look at Maple's treatment of this function on square (i. e., n by n for some positive integer n ) matrices. The following routine defines a general symbolic 3-by-3 matrix A and calculates its determinant. Compare with the misprinted Formula (5), p. 161 of Diacu .
A := Matrix(3, 3, [[a, a, a],
[a, a, a],
[a, a, a] ]);
det(A) := Determinant(A);
Finally, the following routine checks the calculation in Diacu's Example 2, p. 161.
A := Matrix( 3, 3, [[2, 5, -2], [4, -3, 2], [6, 2, -2] ]):
det(A) := Determinant(A);
TM is a registered trademark of Waterloo Maple Inc.
Math rendered by WebEQ