INSTRUCTIONS FOR USING MAPLE at NEIU


In the computer labs from the main menu type T for the Math Menu then type L for the Windows version of Maple.

Saving and Printing

You can save your workspace to your own disk while working (recommended frequently) and when your are done using the pull down FILE menu and the SAVE AS and SAVE commands. Be sure to save to drive a: , the default drive is the j: drive which is a virtual drive, when you exit MAPLE everything on the j: drive disappears forever. To retrieve saved workspaces from your disk use OPEN from the pull down FILE menu, note that only your commands are saved, not the results. You need to execute each result by pressing Enter or use Execute Worksheet in the FORMAT menu.

You can also save individual or groups of variables or user defined procedures, see save in the HELP browser.

You can print out your workspace or a plot using PRINT from the file menu. The default printer is the line printer which is fast but often not very good. To use the laser printers you must change printers from the main menu before entering MAPLE, then while in MAPLE you must also select the correct printer from the PRINTER SETUP dialog box from the FILE menu. The lab aides should be able to help you with this.

SOME IMPORTANT POINTS

  1. The assignment operator is := as in Pascal. The = sign is used in equations.
  2. Each MAPLE statement must end in a semicolon ";". MAPLE will not accept a line of input unless it ends with a semicolon.
  3. The multiplication operator * is required, i.e. 3x is not valid MAPLE syntax, at least if you mean 3*x.
  4. MAPLE uses parentheses ( ) for functions, square brackets [] for indices.
  5. To obtain a floating point approximation to a rational or algebraic number use the evalf( ) function.
  6. To substitute a value (say c) for an indeterminant (say x) use subs, as in
    subs(x=3, x^3 - x + 2);
  7. Generally MAPLE functions start with a small letter while constants (eg. Pi) start with a capital letter. Exceptions are "inert" functions which return no assignable output.
  8. The last result calculated is saved under the name " (double quote marks). Thus to get a floating point approximation of the last result type evalf(");
  9. Previous results cannot be edited, but previous commands can be edited in usual Windows fashion.
  10. The internal and printed accuracy of floating point numbers is determined by the Digits variable. If you wish your work to be accurate to, say, 30 digits use Digits := 30; Digits must be a number under 500,000.

INTRODUCTION TO MAPLE

The syntax for MAPLE is similar to languages such as Pascal or C with one important difference. Variables which have not been assigned values are treated as indeterminants. Algebraic expressions in these variables are then manipulated algebraically. Also MAPLE treats rational numbers, algebraic numbers (such as sqrt(2)) and floating point numbers differently. The quotient of two rational numbers is a fraction. Roots of rational numbers are not automatically evaluated as floating point numbers. Numbers with decimal points are floating point numbers. Complex arithmetic is supported, the letter "I" is used to denote the square root of -1.

Here are some MAPLE functions for manipulation of polynomials and, when appropriate, more general functions. If you want to use the results be sure to assign them to a variable eg.

y := solve(x^2 + x = 6,x);
is a variable containing both solutions of this quadratic. In what follows "f", "g" are expressions in the indeterminant x, eg.
f := x^3 - 2*x^2 + x - 1;
normal(f); simplify(f), expand(f) ,factor(f)
These three commands may change the form of the expression f. The result may be nicer or more complicated.
collect(f,x), sort(f,x)
collect collects powers of the variable x together, sort puts these powers in order.
solve(f=0,x);
Gives exact solution to equation f(x) = 0.
fsolve(f=0,x); fsolve(f=0,x=a..b);
Gives floating point real solutions to f = 0, in the second case only solutions in the interval [a,b]
fsolve(f=0,x,complex);
Gives complex solutions to f=0, all complex solutions for a polynomial.
diff(f,x);
Differentiates f with respect to x For nice display combine with the inert form, for example
Diff(sin(x)/x, x) = diff(sin(x)/x, x);
use subs(x=c,diff(f,x)); To get f'(c).
int(f,x);
Indefinite integral of f with respect to x, again for nice display use
Int(sec(x)^3,x) = int(sec(x)^3,x);
int(f,x=a..b);
Definite integral of f from a to b. Note you will get an exact value, a,b may be numbers or indeterminants.
Combine with evalf to get numerical integral, best is
evalf(Int(f, x=a..b));
taylor(f,x=c,n), series(f,x,n)
First n terms of Taylor, (resp. MacLaurin) series of f about c.

Some Graphics Commands

plot(f);
Graphs y = f(x) with default x and y scales (not recommended)
plot(f,x=a..b);
Graphs with domain [a,b]. Chooses appropriate y scale.
plot(f,x=a..b, y=c..d);
User chosen x and y scales.
plot({f,g,h}, x = a..b);
Graphs the three functions f,g,h on the same axes.
Note that in MAPLE you can vary the style parameters inside the plot window.
An example of a parametric plot is
plot([3*t, t^2, t=0..5]);
A plot in polar coordinates is
plot([1 + cos(t), t, t=0..2*Pi], -3..3, -2..2, coords=polar);
One can plot functions of two variables
plot3d(f, x=a..b, y=c..d); This graphs z = f(x,y). A nice example is
plot3d(sin(x^2+y^2)/(x^2+y^2), x=-3..3, y=-3..3);
You can plot specific points. For example, try
plot([[0,0],[1,2], [2,1],[3,5],[4,0]]); and
plot([[0,0],[1,2],[2,1],[3,5],[4,0]], style = POINT);
A unique feature in MAPLE is implicit function plotting. Implicit plotting and some other specialized plots are in the plots package. For example
with(plots);
This loads the plotting routines, required before using the more specialized plot routines.
implicitplot(f=c, x=a..b, y=c..d);
This attempts to plot the solution set of the equation f=c.
There are many other kinds of plots such as contour plots, matrix (point) plots, vector field plots, DE plots and statitistical plots. See the Help menu.

Programming

Finally we mention programming in MAPLE. This is similar to Pascal programming except that there is a large library of routines and a large number of data types, including indeterminants.

For example, if instead of using fsolve() to find all roots of an equation we wish to explore Newton's method we can create our own Newton's method:

     Newton :=
          proc(a)
               xi := a;
               for i from 1 to 5 
                 do
                    xi := subs(x=xi, x - f/diff(f,x));
                    print(xi);
                 od
          end;
It is recommended that you use Shift-return rather than return when writing a program to eliminate the line MAPLE usually skips. You must enter plain return at the end of the program. Note that while entering this program MAPLE will do nothing until the end; statement is entered. This program can be edited in usual WINDOWS fashion, just be sure to type Enter when you are done.

To use this program enter f as an expression and then type Newton(xo); where xo is the initial value. Note that if xo is a rational number, algebraic number or indeterminant the output can get enormous. This is why I only used 5 iterations. With 15 iterations an unfortunate entry of an indeterminant can use up all available memory. You can exit from a runaway calculation using the STOP button in the WINDOWS version of MAPLE. A more complicated program would use type checking and type conversions to avoid these problems. Programs can be saved in text or compiled format (still usable only in the MAPLE environment) for later use.

Explore Further

You should use the Help menu to explore MAPLE further. MAPLE comes with packages DEtools, linalg, plots, numapprox, simplex, stats among many others. You should peruse those packages in your areas of interest.