# Maple for Ohio State ECE

## Getting started with Maple

Note: This document was written under the HPUX operating system, which is now deprecated with the department. To the best of our knowledge, the basics presented here continue to hold on other installations, but if you note an issue with what is presented and what you are seeing with your own experiences, please send a note to Site.

## This document covers these subjects

- What is Maple?
- Starting Maple
- Plotting on the HPs
- How to print
- Using Maple's on-line help facilities
- Learning more about Maple
- How to quit Maple

## What is Maple?

Maple is a tool for symbolic mathematical calculation. Maple can do expand, simplify, and factor algebraic expressions, integrate and differentiate, and solve linear and differential equations or systems of equations. Maple works symbolically rather than with numerical approximations, which means that if you ask it for the integral of sin(x) with respect to x it will give you -cos(x). Maple can also plot functions.

Here are a few very simple examples:

Expression |
Maple Command |
Maple Output |

the integral of sin(x) with respect to x |
int(cos(x),x); | sin(x) |

the sum of 2 to -kth power for k=0 to infinity |
sum('1/(2^k)', 'k'=0..infinity); | 2 |

the derivative of the log of x squared |
diff(log(x^2),x); | 2/x |

the solution of x*x - 3x + 2 = 0 |
solve(x^2-3*x+2=0); | 2,1 |

## Starting Maple

Sit down at one of the Unix systems in DL557 and log in.

Using the mouse, position the cursor on the background, away from any of the windows. The mouse cursor will change to **X**. Press and hold the right mouse button to bring up the `Root Menu`

. The cursor will change to an arrow while you are holding the right button. Slide the arrow down to the menu entry `Design tools`

. The `Design tools`

menu will appear. Slide the arrow to the right until it is on the `Design tools`

menu, then down until it is on the entry `Maple`

. Now release the button.

The outline of a rectangle will appear on the screen. This will be the Maple window, as soon as you've told the computer where you want it. Using the mouse, position this outline anywhere you like on the screen. When you like the position of the box, click the left mouse button. The outline will fill in. The window will say `Maple V Release 3`

in the title bar on top. Below the title bar is a menu bar (you can access the menus by clicking the left mouse button on one of the menu labels) and below the menu bar are three buttons you can use to stop or pause Maple's calculations. The large area in the middle of the window is where you type Maple commands, and where Maple will display most of its results. It contains the Maple prompt, which looks like this: **>**

You can also start up maple from a shell prompt, by typing: xmaple &

## Plotting on the HPs

To bring up a simple plot, type the following command in the Maple window: plot( cos(3*x)*sinh(x)*exp(-x\ctrl{2}), x=-5..5);

*Don't leave out the semicolon (;) at the end of the line. Maple needs it to know that you've typed a complete expression.* The outline of a new window will soon appear on the screen. Place it by clicking the left mouse button, and the new window will appear, titled

`Maple V 2D`

and showing a plot of this function.Maple can also do three dimensional plots---try the commands:

- r := (x\ctrl{2}+y\ctrl{2})\ctrl{(1/2)};

plot3d( cos(y)*BesselJ(0,r), x=-5..5, y=-5..5);

## How to print

To get a printed copy of the plot, you first need to create a file containing a Postscript version of the plot. To do this, move the mouse cursor onto the word `File`

which appears in the top left corner of the plot window. Do this in the plot window, not in the main Maple window. Click and hold the left mouse button, and slide the cursor down to select the `Print`

option, then slide the cursor right and select the `Postscript`

option. A small window will pop up, asking you to confirm the name for the file to be created. Change the name if you like, then select `Confirm`

.

Now go to one of your `xterm`

windows and you can print the file with the `lp`

command. If you accepted Maple's default file name, the command to do this would be: lp plotoutfile.ps

Be sure you are in the correct directory for this! If Maple was started from the mouse menu, the file will be saved in your top level home directory. Otherwise, it will be saved in the directory from which you started Maple.

To remove a plot window, select `Exit`

from the `File`

menu in the plot window, or hold down the `<Alt>`

key and type `x`

in the plot window.

## Online help facilities

Maple has extensive built-in help facilities, which you can get at in several ways. One way is through the `Help`

menu in the upper right corner of the Maple window. Under this menu you'll find the `Help Browser`

, which lets you select help by category, and the `Keyword Search`

, which lets you search the entire set of help files for a particular word or topic.

You can also look at help files by using the help command `(?)`

at the Maple prompt. Follow the question mark with the name of a command for which you need help, and Maple will give you an appropriate help window. Here are some ways to use the help command:

?intro?library ?index ?index,category ?topic ?topic,subtopic |
- Introduction to Maple - Maple library functions and procedures - List of all help categories - List of help files on specific topics - Explanation of a specific topic - Explanation of a subtopic under a topic |

## Learning more

Maple is a very powerful tool, and you'll have to do some reading before becoming proficient at it. You can learn all you need to by browsing through the on-line help and experimenting, but fortunately this is not the only way. There is a very good tutorial introduction to Maple in the book *First Leaves: A Tutorial Introduction to Maple V.* Bruce W. Char et al., Springer-Verlag, 1992.

## How to quit Maple

Select `Exit`

from the `File`

menu. Or, hold down the `<Alt>`

key and type `x`

in the Maple window. Or, type `quit`

in the Maple window.