CHAPTER 1

Basic Procedures in Using Maple


This set of notes will introduce you to the use of Maple particularly as it is used in a Unix environment. The two languages Matlab and Maple compliment each other in scientific use of a computer. MATLAB is a very easy language for numerical computation. Maple allows you to manipulate symbols so that you can find general solutions to many problems. Both languages have good graphic capabilities. In many problems, you may want to find as general a solution as you can with Maple and then to look at specific cases with MATLAB.In the Owlnet Notes for this course you will find: An introduction to Unix, Information about windowing and tools in X-Windows

You should be familiar with enough Unix; to use your workstation reasonably well, before you start learning Maple. The latest version of Maple is Maple V release 5. This is the version that was used to make up examples in thses notes.

A description of most of the commands and techniques for programming will be found in the Maple V Reference Manual. These notes cover only a small number of these commands so if you wish to expand your use of Maple, you should obtain or have access to one of these Manuals. The main purpose of these notes is to describe techniques found to be useful in a variety of problems in introductory engineering and mathematics courses. We have also collected a number of problems that we hope will challenge you to learn even more techniques. There are a large number of Maple commands that cover a variety of types of operations. Thus you will find that the use of the reference manual or on-line help will be essential to understand the way to use the language effectively.

Note that these notes contain many examples from Maple. However, only the commands executed in the examples can be copied to another window. The results shown from each is reproduced in image files. The examples (i.e. the mws worksheets) in Maple have also been saved in the directory :

/home/ceng303/maple/sessions

These documents can be opened in Maple Vr5 and you can execute them in order to help understand them. Each line in these example files can be copied into new Maple worksheets.

Other Web sites with Details about Maple and its Applications


The following web sites were copied from CAIN Europe:


There are many other documents on computer algebra systems described in the links from CAIN Europe.

In contrast to MATLAB, which has a definite numerical bias, Maple is oriented toward symbolic computation. It deals directly in structures that represent parts of algebraic or differential equations. The X Windows version of Maple has windowing capabilities (copying, cutting, pasting, etc.), help windows, and much improved two- and three-dimensional interactive graphics. These new graphic capabilities allow version V of Maple to be used for numerical presentations as well a symbolic manipulations. A brief description of Maple may be found in a Tutorial by Char et al (First Leaves: A Tutorial Introduction to Maple V). More information may be found in the Maple V Language and Library Reference Manuals.

There are several languages available for a variety of computers that have become available in the past few years. MACSYMA, Mathematica and REDUCE for example also give the user the option to perform symbolic manipulations of equations.

We will point out here some features of Maple that allow the user to do mathematical operations that would be quite cumbersome in FORTRAN or MATLAB. In some sense the way that symbols are manipulated is similar to the way that MATLAB evaluates character strings. Basic variables (Maple expressions) are set up symbolically or simply as character strings, but quotes are not used to indicate this. Punctuation is quite different from what you have seen in other languages.

The following capabilities of Maple V will be described in this chapter:

1.1 Getting into and out of Maple
1.2 The Maple Window
1.3 The Options Menu
1.4 Maple Help Windows
1.5 Defining a Maple Expression
1.6 Defining a Simple Function
1.7 Differentiation in Maple
1.8 Integration in Maple
1.9 Simplifying Expressions
1.10 Series approximations
1.11 Solving Equations

1.1 Getting into and out of Maple

One way to get into Maple on a Unix network like Owlnet is to open the Applications menu in the gray part of the screen with the right mouse button. Highlight the Engineering Apps button and move the mouse a little to the right. This should bring up the Engineering Applications menu that includes Maple. Highlight the Maple bar in the menu by pointing to it with the right button held down and let go of the button. A window will open labeled as Maple V Release 5 (this may change as time goes on).

At the top of the Maple window, there are eight menu options.

"File" : Create, open, delete, and print Maple files
"Edit" : Allows editing operations on text
"View" : Change viewing options in Maple
"Insert" : Insert various inputs into worksheets
"Format" : Format worksheets
"Options" : Change other options in Maple
"Window" : Change window attributes of worksheets
"Help" : Opens a Maple on-line help window


Right below the menu options are Maple's toolbars which can be customized by the user. The toolbars contain shortcuts, via buttons, to numerous Maple functions. These include opening files, saving files, printing, inserting text input, and cut/copy/paste.

Note that the Maple prompt is a single ``>'' and that the help command is ?. The ``Help'' menu option may also be used for reading the help files. The first time you try Maple, you should note the prompt and type ?. This will open the Maple V Help window. It includes valuable information about getting on-line help in Maple.

There are also important reminders about Maple's required punctuation given in this help window. You should not find it difficult to get used to the requirement for giving either a semicolon (;) or a colon (:) to end all commands except quit; and lines that start with a ? asking for help on a particular subject. You will find that nothing happens until you type ; or : in all other cases. Note also that the Back Space key is used to delete text in Maple.


1.2 The Maple Window

Maple commands are typed into the Maple window; as into any terminal window. These commands are sent to Maple when you press the Return key. You can also type a group of commands separated by the Line Feed key. You then execute the commands by selecting them with the mouse and pressing the Return key.

One impressive feature of Maple Vr5 is the color scheme :

  • Red : Maple commands/functions entered by user
  • Blue : Maple output in response to Maple inputs
  • Black : Comments entered by user.
Whenever you press the Return key, the current line (the line containing the text cursor) is sent to Maple. If some text is selected, the entire selected text is sent to Maple for execution.

Because the Maple window is an X text window, text can be copied from other windows (for example, an xterm or Maple help window) and pasted into the Maple session. You cannot however copy and paste output from the Maple window into other text windows. If you want to put a copy of the output, you will need to export the session to a text file first.

Maple helps to prevent clutter in its window by drawing a horizontal line after each Maple output expression so that input and output expression pairs are grouped visually and separated from other pairs. Also, upon executing a command after editing a previously input command, the subsequent output replaces the previous output.


1.3 The Options Menu

Clicking on the Options button brings up a menu of screen related operations. The menu items fall into two distinct categories. The first two items are "Replace Output" and "Insert Mode". With Replace Output ON, upon reading a file of Maple commands and executing the first command, the output of the first command will replace all of the remaining commands. With Replace Output OFF, the commands can be executed individually. The last three items produce sub-menus which are useful for altering the way equations are displayed in the Maple window.


1.4 Maple Help Windows

Maple's on-line help can be accessed either by selecting an option from the "Help" menu option or by simply typing a question mark (?) followed by a topic. Typing just a question mark (followed by Return) opens the help window describing the Help command. If you begin getting syntax error messages when trying to get help, refer to this Help help window. If typing ? gives you a syntax error message, open a fresh Maple session window.

You should become acquainted with the different categories of functions, statements, and programs that you can see with the help command. You can get this list by: ? index.This produces a Maple help window on "Index" listing the six categories of topics in Maple Help :

Each time you ask for help in Maple V run under X-windows, you will open a new window that has the text in it. When you are finished reading the material in the window, close it with the button at the top of the window. You can open as many help windows as you wish from the main Maple window; their hierarchical arrangement often makes opening several desirable.

Some help files contain examples. You can try out any one of these examples by copying it from the help window and pasting it into the Maple session window. Then, after pasting it, you may edit the example if you wish before typing a Return.

Many help windows have a list at the bottom of the window. This list contains other topics from Maple Help which give further information about a certain topic.


1.5 Defining a Maple Expression

Note that the link in this heading will lead to the Session 1.5 where some examples are shown. All of the operations and techniques shown in this session could easily be done in MATLAB. A list of built in Maple operations that would not be duplicated without a lot of effort in MATLAB will allow us to:

1) differentiate nearly any expression,
2) integrate many expressions,
3) sum many expressions,
4) simplify expressions,
5) find series approximations to functions,
6) solve equations represented by expressions to get symbolic answers.
Before showing these operations, we will demonstrate one way to define simple functions.


1.6 Defining a Simple Function

Among the new features of Maple V is the "arrow notation" for defining functions. Here is what ?Maple V tells us about it:

We will look at the first example given in that help window and show how such a function differs from the "expressions" shown in the last session. A comparison of expressions that look like functions with "true" functions may be seen in session 1.6.


1.7 Differentiation in Maple

The way to differentiate a function or expression is to simply use diff as shown next:

diff(expression or function, variable);

where the first argument gives the function to be differentiated and the variable indicates what the function is to be differentiated with respect to. Differentiation of several functions is seen in session 1.7. The session starts in a clean workspace.


1.8 Integration in Maple

An indefinite integral may be found with int in the same way that diff was used as seen in session 1.8.


1.9 Simplifying Expressions

Certain expressions are automatically simplified by Maple. Others will only be simplified by forcing this to happen. There are several commands that can help in simplifying an expression.

normal(expression);

simplify(expression);

These are show in session 1.9.


1.10 Series Approximations

The taylor and series functions may be used to generate Taylor's seriesand some Laurent series. The form is:

taylor(expression,variable=center point,order);

series(expression,variable=center point,order);

A Taylor's series in the variable is formed about the center and the number of terms required to achieve the specified order is printed. If the function has a pole at the center, a Laurent series about that point is given. Several examples are shown in session 1.10.
 
 


1.11 Solving Equations

Linear equations and some nonlinear equations may be solved symbolically in Maple. The form for using solve is:

solve(equation(s),variable(s));

The variable(s) are treated as unknowns in the equation(s) and a solution is sought. If successful, the solution is returned, otherwise a warning message is printed. The message may only mean that Maple cannot find the solution. Several examples are shown in session 1.11.
 


Return to Table of Contents