next up previous
Next: Assignments, Functions and Constants Up: Preliminaries about Maple Previous: Basic Maple

Subsections


The Maple worksheet

Maple's graphical interface allows you to keep a collection of commands and their results in one place, to save your work, and resume previous sessions. You can also add comments and text to your worksheet, to make it more readable and to describe the process of solving the problem. It also enables you to structure your worksheet into sections of related items.

Introducing the worksheet

As we have seen, you enter Maple commands at the > prompt, and the results appear in your worksheet. If you go back and change a Maple command and re-execute it, the result in the worksheet changes.

At the top of the screen is a menu bar (with entries like File, Edit, and so on): clicking on each of these words gives you a menu which allows you to affect your session in various ways. For example, clicking on the File menu and selecting Save will allow you to save your current worksheet for later use; selecting Open from the same menu allows you to load an existing worksheet.

Figure 2: The menu bar, button bar, and context bar.
\begin{figure}\centerline{ \psfig{figure=wsmenubar.ps,width=.9\hsize}}\end{figure}

Below the menu bar is a collection of buttons which are short-cuts for items found on the various menus. Clicking on one of these is much quicker than searching for the command on the proper menu. For example, the button that looks like a floppy disk ( \psfig{figure=ws-savebutton.ps,height=2ex}) saves the current worksheet, and the magnifying glasses ( \psfig{figure=ws-magbuttons.ps,height=2ex}) adjust the zoom factor (or magnification) of the current worksheet. The stop sign interrupts a computation, which is very useful if you ask Maple to do something that takes a very long time, such as to find the factors of 21000 - 1.

Below this is the ``context bar'', which changes depending on what kind of item you currently have selected. For example, as mentioned in §2.3, when graphics are selected there are buttons to adjust the style of graphics (points or lines for 2-dimensional graphics, shading on 3-dimensional graphics), axes style, and so on. When a text item or comment section is chosen, selections for typeface, centering, and so on appear.

Worksheet basics: the front-end and the kernel

It is important to remember that the worksheet is only a record of a Maple session, not the session itself. Since you have the ability to edit and reorder it, it can sometimes appear to contain inconsistent information. Here is a small example:

First, suppose we issue the following commands:

> 
  one:= sin(x)^2 + cos(x)^2;


\begin{maplelatex}
\begin{displaymath}one := \sin(x)^2 + \cos(x)^2 \end{displaymath}\end{maplelatex}

> 
  diff(one,x);


\begin{maplelatex}
\begin{displaymath}0 \end{displaymath}\end{maplelatex}

The command diff(one,x) asks Maple to compute the derivative of the expression called one with respect to the variable x. The result is, of course, 0 because sin2x + cos2x is a constant.

Now, we go back and change the + in the definition of one to a -, and execute the statement. However, we do not execute the diff command. Our worksheet now looks like this:

> 
  one:= sin(x)^2 - cos(x)^2;


\begin{maplelatex}
\begin{displaymath}one := \sin(x)^2 - \cos(x)^2 \end{displaymath}\end{maplelatex}

> 
  diff(one,x);


\begin{maplelatex}
\begin{displaymath}0 \end{displaymath}\end{maplelatex}

This seems to contain an error (the derivative should be 4 sin(x)cos(x)). Obviously, this is because we we didn't execute all the statements. If you place your cursor on the line with diff(one,x) and hit the return key, the worksheet will be correct again.

This may seem like a silly discussion, but this apparently obvious example is to make an important point: Maple only ``sees'' your commands in the order you execute them, not in the order you see them in the worksheet. Also, if you load a worksheet from a previous session (or made by someone else), any assignments and results will not be accessible to the Maple session until you execute those statements, even though the results appear on your screen.

To help you understand why this is, we point out that a Maple session typically consists of two processes (or programs) which communicate with each other: the Maple kernel and the ``front-end'', or user interface. The front-end is the part that interacts with the user, accepting your commands, showing the results of your computations, and so on. The kernel is the part that does the actual computations. In certain situations (for example, when using a ``parallel Maple kernel''), it is possible to have more than one Maple kernel associated with the same front-end.


Online Maple help

Maple has an extensive and very useful online help system, containing information on all of the commands, as well as a number of tutorials and example worksheets.1.7Spending some time exploring the help system is well worth the effort. There are a few ways to get into the system; one obvious one is to select from the Help menu (on the right of the menu bar). But if you know the specific item you want help on, you can also do this in a quicker way.

Suppose you want information on Maple's factor command. Enter the Maple command

> 
  ?factor

(here the semicolon is optional). Then Maple creates another window that very likely will contain more information than you really need or care about. You can read all or part of the information displayed in this window by moving the text down with the scroll bar to the right of the window. You can also click in the help window, and use the arrow keys on your keyboard.

You should notice that at the end of the help window you will find a good set of examples on the uses of the command you are inquiring about. This examples can be copied and pasted in your worksheet and executed. In this way, you can see what the command really does.

Usually there is also a section labeled ``See Also'', which points you to related commands. Each of these words is a link to another help page. It works like a web browser: clicking the underlined word takes you to the help page on that topic.1.8You can use the back button ( \psfig{figure=ws-backbutton.ps,height=2ex}) to return to the previous help page.


Figure 3: Maple's help index.
\begin{figure}\centerline{\psfig{figure=ws-helpindex.ps,width=.8\hsize}}\end{figure}

At the top of each help page is the help index (see Fig 3), which is a table of contents for the entire help system, organized by topic. You can use this to browse for commands you might not otherwise have known about.

Finally, on the Help menu are entries called ``topic search'' and ``full text search''. The first looks for help on a specific topic, and the latter searches the text of every page in the help system for the word you ask. Both of these can be valuable resources when used properly.

Documenting and structuring your worksheet

Aside from the great advantage of making it easy to keep track of your commands and their results, the worksheet has some features of a word processor, allowing you to insert comments and text which describes your solution (or anything else you like). This can be very important, especially if you intend to show your worksheet to someone else (or even look at it yourself later).

To enter text into a worksheet, click on where you'd like it to go, and hit the text-mode button (it looks like \psfig{figure=ws-textbutton.ps,height=2ex}). Note that this button will convert a Maple input region (that is, one with a > prompt) to a text region-- you'd probably prefer to insert your comments rather than change your commands to comments. To do this, either click before the > prompt, or select Paragraph...Before from the Insert menu.

In the text region, you can type whatever you like, using the context bar to adjust formatting such as the typeface, centering, etc. You can even include mathematical expressions in your text: click the ``math input'' button ( \psfig{figure=ws-mathbutton.ps,height=2ex})1.9and type the Maple expression for the math you want. When you are done, use the text-mode button to return to entering text. You can also paste the output from a previously executed Maple command into the text area.


The worksheet interface also allows you to group parts of your worksheet into sections. These sections can contain paragraphs and Maple execution groups, and subsections. You can recognize a section by a large square bracket to the left, with a box at the top of it. Clicking on the box collapses the section, showing only the its title. Collapsing all sections allows you to see the structure of your document in outline form. To expand a collapsed section, click on the box next to the title.


For an extensive description of how to document and structure your worksheets, see the ``Documenting your Work'' section in the online help. This can be invoked with ?documenting.



Footnotes

... worksheets.1.7
There is even help on the help system. Select Using Help from the Help menu, or give the command ?helpguide.
... topic.1.8
If you prefer, holding the Control key while clicking on the link opens the page in a new help window, allowing you to view both at the same time.
...)1.9
Or select Math Input from the Insert menu.

next up previous
Next: Assignments, Functions and Constants Up: Preliminaries about Maple Previous: Basic Maple

Translated from LaTeX by Scott Sutherland
2002-08-29