Maple Tutorial for Linear Algebra
On most platforms, Maple V is started by double-clicking on the Maple icon. However, in our Computer Lab in HH-3030/3056 you can simply type xmaple or xmaple & to start a Maple session. If you are familiar with the Unix environment you can create a Maple subdirectory and start Maple from within that subdirectory.
At the top of the window is the menu bar containing such menus as File and Edit . Immediately below the menu bar is the tool bar , which contains button-based shortcuts to common operations such as opening, saving, and printing. Immediately below the tool bar is the context bar which contains controls specific to the task you are currently performing. The next area is large and displays your worksheet, the region in which you work. At the bottom of the window is the status bar, which displays system information. The worksheet should have opened with the prompt (>) in the upper left corner. This worksheet can be viewed and downloaded from my home page. The URL is http://www.math.mun.ca/~drideout . If you download the worksheet, you should execute each of the commands, after the prompt (>), either one at a time or go to the menu bar, and then edit, and then execute the whole worksheet.
We will introduce Maple commands which will be useful in Mathematics 2050 or 2051. Maple V provides a wide range of special packages specially designed for students. For example, there are packages for calculus, statistics, number theory, group theory, and graph theory. One of the most frequently used packages is the linear algebra package, linalg . This package provides a complete set of commands for working with vectors and matrices.
First load the linear algebra package using the with command. If you do not wish to load the entire package, you can load selected routines from the package using the syntax
with(packagename, routine1, ..., routineN);
You can also use the long form of the routine name
Warning, new definition for norm
Warning, new definition for trace
Note the many functions that are listed above. To find more information on any topic you can look at the help pages by typing ?topic . For example, ?addrow will show you clearly, with examples, how to use this function. Experiment, by executing the command ?addrow on a command line.
Solving Systems of Equations
An array is a generalization of the matrix data structure. The conversion between arrays and matrices is automatic, so following the creation of an array it can be used as a matrix.
Consider the 4x6 numeric matrix created using the array command.
The above label A always refers to the above matrix unless we unassign the symbol A. Note the use of the semicolin (;). The semicolin is always needed in order to see the output. If you do not want to see the output, end the command with the colin (:) instead.
The matrix is not displayed. It is displayed using the evalm command.
The command print(A) will also work. The following command unassigns the symbol A.
The above matrix can also be defined with the matrix command.
If A is the coefficient matrix and B the constant matrix of a system of 4 equations in 6 unknowns, then one way to solve the system is to form the augmented matrix.
Next we can row-reduce the matrix by using the commands addrow, mulrow, and swaprow , as many times as is necessary. The symbol (%) always refers to the latest output.
We could have gotten to the same place in the computation by using the gausselim command, except that the leading numbers are not necessarily 1's.
To put the matrix row_esc_form in reduced row eschelon form, we continue with the following computations.
As above, we can use one command in Maple to do the same thing. Either use the command rref or the following.
As you may have already guessed, Maple has one command to do all of the above at once.
Note the three free variables, . Another way to solve the system is to write the equations out, and use the solve command.
The free variables here are x2, x4, and x6. Show that the two solutions are equivalent. Another facility built into linalg can extract the coefficient matrix and the constant matrix from a system of linear equations.
How can we denote the identity matrix? We cannot use the symbol I , since it is reserved for . Check the help page on the word alias .
> evalm(%%&*%); # Note (%%) refers to second last output. The stuff after the symbol # is a comment and is not executed on the command line.