0% found this document useful (0 votes)
70 views

What Is Maple?: Using Math Software Under UNIX

This tutorial assumes that you are running Maple V release 5. Maple is essentially the same on Microsoft windows, macintosh, and X windows system. If you are using a character-based terminal, the maple commands will be the same although the interface is different (no mouse, no menus, and typewriter graphics)
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

What Is Maple?: Using Math Software Under UNIX

This tutorial assumes that you are running Maple V release 5. Maple is essentially the same on Microsoft windows, macintosh, and X windows system. If you are using a character-based terminal, the maple commands will be the same although the interface is different (no mouse, no menus, and typewriter graphics)
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Getting Started with Maple

Introduction
What is Maple?
Maple is a computer program for people doing mathematics. Using Maple to do your calculations should make the work more interesting, allow you to focus more on the concepts, and help you to avoid silly calculation mistakes.

How to use this tutorial


This document is intended to get you started, and show you how to learn more. It is intended to be used while sitting at a terminal running Maple in a windowed environment, by entering the commands and thinking about the output. To use any software effectively, some knowledge of the computer's operating system is required. This document will assume that you are already familiar with the rudiments of windows -- things like point, click and drag, how to use menus, and the standard way to open and close files. Maple is essentially the same on Microsoft Windows, Macintosh, and the X windows system, but there are minor differences in their interface. This tutorial assumes that you are running Maple V release 5.1 in one of the previously listed environments. If you are using a character-based terminal, for example in a telnet session, the Maple commands will be the same although the interface is different (no mouse, no menus, and typewriter graphics). If you are using Maple over telnet, ssh, or through any other terminal, you may wish to read Using Math Software under UNIX after you are done with this tutorial. In order to be more broadly understood, we don't include some things which require a lot of mathematical knowledge, for example linear algebra. Subject oriented guides are also available -see our By Subject page. We'll be using some standard conventions throughout this document. Example Explanation

File -> Open Choose the file menu, and select Open. a := 5; a := 5 Input to be typed at the Maple prompt. Output from Maple. An important tip.

Where can I find Maple?


Maple is available in all IUB Student Technology Centers. q On NT (PC) computers, go to Start Menu -> Programs -> Statistics and Math -> Maple V Release 5.1 -> Maple V Release 5.1.
http://pytheas.ucs.indiana.edu/~statmath/math/maple/gettingstarted/printable.html (1 of 10) [3/30/2000 11:01:37 AM]

Getting Started with Maple

q q

On Macintosh computers, go to Apple Menu -> Statistics and Math -> Maple V Release 5.1 (PowerPC). On UNIX workstations, the X windows version is invoked by the command xmaple &. Maple is also available on most IU central systems - see the Availability page.

How to start and exit Maple


To start maple: q On NT (PC) computers, go to Start Menu -> Programs -> Statistics and Math -> Maple V Release 5.1 -> Maple V Release 5.1. q On Macintosh computers, go to Apple Menu -> Statistics and Math -> Maple V Release 5.1 (PowerPC). q On UNIX workstations, the X windows version is invoked by the command xmaple &. To exit Maple, choose File -> Exit or type exit;.

Finding your way around the window


The Toolbar
First of all, locate the toolbar at the top of the window. On NT, it looks like this:

Other operating systems have a similar toolbar. Every time you work with maple, you will use a "worksheet". The worksheet is the big, blank area in the middle of the screen. You may have more than one worksheet open at a time. The following toolbar buttons let you work with the worksheet. The first four buttons on the toolbar, in order, do the following: open a new, blank worksheet; open an existing worksheet; save the current worksheet; and print the current worksheet. The next three buttons are the standard cut, copy, and paste functions. The next two buttons let you "undo" and "redo" your last action. The next three buttons let you manage what "mode" Maple is currently in. The standard mode is represented by the capital Sigma button. This means that anything you type will be considered to be mathematical input. If you click the capital T, Maple switches to Text mode. Anything you type will be considered as text commentary, and Maple won't try to treat it as math. To switch back to math input mode, click the [> button. Notice that the prompt in the worksheet window changes to let you know what mode you are in.

http://pytheas.ucs.indiana.edu/~statmath/math/maple/gettingstarted/printable.html (2 of 10) [3/30/2000 11:01:37 AM]

Getting Started with Maple

The next two buttons let you un-indent and indent lines in your worksheet. The next button has a stop sign on it. It is used as a "panic" button. If you start a computation and you would like to stop, click the stop sign. (Cntl-C will also do this.) The next three buttons control the amount of zoom.

The Kernel
The kernel is the part of Maple that does the actual calculation. The kernel is invisible, but you do need to know about it. You talk to the kernel by typing mathematical statements and commands at the Maple prompt. Here is an example.

If you're using a graphics-enabled browser, you'll notice that input appears in red. Output from the kernel appears in blue, with variable names in italics. The Maple prompt looks like [>. The kernel will execute when you press the Enter key. The kernel decides what to execute by looking at the current execution group. An execution group is a set of input lines connected (along the left-hand margin) by a long, thin [. When you press Enter anywhere in the execution group, the entire group is executed. By default, each input line (along with its output) is an execution group unto itself. You can join execution groups together using the F4 key, or split them apart using the F3 key. Execution only occurs when you press the Enter key, or if you choose Edit->Execute->Worksheet. Execution does not occur when you open a worksheet.

Worksheets
The worksheet is the basic unit of work in Maple, like a document in a word processor. A worksheet stores every line of input and every line of output. To save your worksheet, choose File->Save As. To open a worksheet, choose File->Open. You may have more than one worksheet open at a time. However, they all share the same kernel. So any work you do in one worksheet is accessible from another open worksheet. This can lead to confusing results.

http://pytheas.ucs.indiana.edu/~statmath/math/maple/gettingstarted/printable.html (3 of 10) [3/30/2000 11:01:37 AM]

Getting Started with Maple

Using the Help System


Maple has an extremely in-depth help system. To access it, choose Help -> Topic Search. Enter the word you are looking for (e.g., matrix) and you should see a list of topics. Clicking on one will open a "help browser", a window that lets you wander through related topics. We suggest that you "surf" the help system - casually browse, looking at anything that seems interesting. That way you will have some idea of what is available to you in the future. If you know exactly what you need help on, you may also type (in Maple) > ? simplify (for example) to get help on the Maple command "simplify". A very useful feature of the help system is the examples section. Use the Edit->Copy Examples menu command to copy the examples. Then switch to your worksheet (or open a fresh one) and use the Edit->Paste menu command. Now you can execute the examples, and experiment until you are comfortable with the commands.

Maple Syntax and Built-in Data Capabilities


Syntax
As with any computer language, Maple has its own syntax. As a new user of Maple, you can save yourself a lot of head-scratching if you get to know these symbols. Enter the commands given or make up similar problems. Symbol ; : := +, Description End-of-line. Tells Maple to process the line and show the output. End-of-line. Tells Maple to process the line and hide the output. Assignment. Lets you assign values to variables. Addition, subtraction. Examples Sample Output hello; hello: a := 3; a; 1 + 3; 1 - 3; 3*412; 1236/3; 7/3; a := 3 3 4 -2 1236 412 7/3 hello

*, /

Multiplication, division

http://pytheas.ucs.indiana.edu/~statmath/math/maple/gettingstarted/printable.html (4 of 10) [3/30/2000 11:01:37 AM]

Getting Started with Maple

8 ^, sqrt Power, square root 2^3; sqrt(2); 2^(1/2); evalf(7/3); 2.333333333 7.0/3; 2.333333333 2 + 3*I; (2*I)^2; evalf(Pi); %; %%%; 2+3I -4 3.141592654 3.141592654 -4

evalf, .

Floating-point (decimal) evaluation

I,Pi

Imaginary number, Pi.

%, %%

Recall the last output, recall the second-to-last output, etc.

Some syntactical caveats: q Maple is case sensitive. foo, Foo, and FOO are three different things. q Using the % operator can give confusing results. It always returns the last output from the Kernel, which may have nothing to do with where the cursor is (or which worksheet is active). q If Maple doesn't recognize something, it will assume it is a variable. For example, typing i^2 will give you i2, while you may have wanted -1. q You can move your cursor up to a previous line, press Enter, and the line will re-execute. q When copying and pasting using a mouse, by sure to also highlight the execution group symbol ([). If you don't, the lines will be pasted in reverse order due to a bug. q Spaces are optional. q Greek letters may be entered by spelling their name. For example, alpha is always displayed as , and Gamma is displayed as (note upper-case).

Built-in Data Capabilities


Maple can handle arbitrary-precision floating point numbers. In other words, Maple can store as many digits for a number as you like, up to the physical limits of your computer's memory. To control this, use the Digits variable. sqrt(2.0); 1.414213562 Digits := 20: sqrt(2.0); 1.4142135623730950488 Maple sets Digits to be 10 by default. You can also temporarily get precision results by calling evalf with a second argument.

http://pytheas.ucs.indiana.edu/~statmath/math/maple/gettingstarted/printable.html (5 of 10) [3/30/2000 11:01:37 AM]

Getting Started with Maple

evalf(sqrt(2), 15); 1.41421356237310 Large integers are handled automatically.

Using symbolic computation


The main feature of Maple is symbolic computation. In other words, Maple does algebra. Here are some examples. Example (x + y)^2; k := x*y + y^2; (x + y)2 k := xy + y2 Output A basic expression. k is now an alias for the expression. Note that k is simply another name for the expression - they are not equal in the mathematical sense. You can now use k to refer to the expression. Maple immediately substitutes the value of k. You can unassign a variable by assigning it to its own name in single quotes. The simplify command does algebraic simplification. Maple doesn't mind if you re-use names. The old value is lost. Use the solve command to solve equations. Note the use of the = sign. Here, it is used in a mathematical sense. Maple will try different values for x until it finds all of them that make the mathematical statement x2 - 8x + 15 = 3 true. The diff command differentiates an expression with respect to a variable. The int command integrates an expression. Note that the constant of integration is left off. Comments

p := k /(x+y);

k := 'k'; simplify(p);

k y

p := x^2 - 8*x +15; p := x2 - 8x + 15

solve(p=3,x);

2,6

dpdx := diff(p,x);

dpdx := 2x - 8

int(p,x);

http://pytheas.ucs.indiana.edu/~statmath/math/maple/gettingstarted/printable.html (6 of 10) [3/30/2000 11:01:37 AM]

Getting Started with Maple

subs(x=4,p); subs(x=t^2,p);

-1 t4 - 8t2 + 15

The subs command substitutes expressions into other expressions. Notice that p's value is unchanged.

Each of the commands listed here has many powerful, advanced features. See the help files for more information. Use the restart; command to unassign all variables, reset built-in variables (such as Digits) to their original values, and unload all packages. Of course, this should be used with care.

Creating your own Mathematical Functions


We have been working with expressions so far. Maple also supports the mathematical notion of a function. To define a function, you must specify a rule for going from one number to another. Consider the following commands: f := x^2; f := x2 This defines f to be an abbreviation for the expression x2.

f := x -> x^2; f := x -> x2 This defines f to be a function, such that f(x) = x2. f(3); f(t); 9 t2 The function works as standard notation.

A common mistake is to write f(x) := x^2;. This does not define a function. Instead, it makes the four characters on the left an abbreviation for the three characters on the right. Functions are often more useful than expressions. However, many Maple commands (for example, diff) expect an expression as input. If f := x -> x^2, then diff(f,x); doesn't work. However, diff(f(x),x); will work, since f(x) produces the expression x2. To convert an expression into a function, use the unapply command. p := x^3 + 1; p := x3 + 1 f := unapply(p, x); f(3); f := x -> x3 + 1 28

Using packages
When you first load Maple, it knows how to execute several different functions. For example, we used the evalf and simplify functions without having to load them first. Maple comes with a huge number of other useful functions, bundled up in units known as packages. Maple has a modular design -- not all of
http://pytheas.ucs.indiana.edu/~statmath/math/maple/gettingstarted/printable.html (7 of 10) [3/30/2000 11:01:37 AM]

Getting Started with Maple

its functions are loaded at startup. The more specialized capabilities must be explicitly loaded. For example, if you want to work with matrices and vectors, you would want to load the linalg package. with(linalg); The output from with is a list of the new commands that you now have access to. If you don't want to see the list (which can be rather long), use a colon as your end-of-line marker. with(linalg): Even if you use a colon, you may see warning messages. These usually indicate that a command has a new definition. In most cases, this should not be a concern. Some Maple functions are not in packages; instead, they are stored in the older library format. For example, to add the multivarate Taylor series function, mtaylor, use the command readlib(mtaylor); Go exploring among the packages. These are some of the most commonly used packages: student Includes commands for use in a classroom/homework setting. plots Tools for graphics, 3-d, animation, and visualization. linalg Matrices, vectors, and many linear algebra functions. detools Tools for working with ODEs and PDEs. To get a comprehensive list of available packages, choose Help->Introduction, then browse to Mathematics->Packages->Overview.

Basic Plotting
Maple can produce graphs very easily. Here are some examples, showcasing the basic capabilities.

plot( x^2, x=-2..2); A basic plot.

plot( x^2, x=-2..2, y=-10..10); A plot with vertical axis control.

http://pytheas.ucs.indiana.edu/~statmath/math/maple/gettingstarted/printable.html (8 of 10) [3/30/2000 11:01:37 AM]

Getting Started with Maple

plot([x, x^2, x^3], x=-2..2); Plot multiple expressions by enclosing them in brackets.

plot([sin(t),cos(t),t=0..3*Pi/2]); Parametric plots include the plotting range in the brackets.

plot3d(4-x^2-y^2, x=-3..3, y=-2..2); A basic 3-d plot.

plot( x^2, x=-2..2, labels=["Time","Growth"]); A basic plot, with axis labels.

You can control where plots are drawn by choosing Options->Plot Display->Inline or Window. Either way, if you select a plot with the mouse, you can use the toolbar to change the rendering style, axes, and lighting. To copy a plot to the clipboard (as a graphics file), right-click (or Option-Click for Mac users) on the plot and select Copy. Look into these commonly used plotting commands: textplot, textplot3d Draw text anywhere in a plot display Display several plots at once animate, animate3d Adds a dimension of time to your plot. plotoptions Various options, including line weight, color, sampling, etc.

Further Reading
For further guidance as a new user, try the tour. Choose Help->New User's Tour. Other sources of information include:
http://pytheas.ucs.indiana.edu/~statmath/math/maple/gettingstarted/printable.html (9 of 10) [3/30/2000 11:01:37 AM]

Getting Started with Maple

q q q q

The UITS Knowledge Base UITS Education Program Software Manual Locations If you are affiliated with Indiana University, you may also get use Stat/Math Consulting .
Permission to use this document is granted so long as the author is acknowledged and notified. Please send comments and suggestions to:[email protected] Copyright 1995-1999, Indiana University. Last modified: Wednesday, 01-Mar-2000 16:42:46 EST URL /~statmath/math/maple/gettingstarted/printable.html

http://pytheas.ucs.indiana.edu/~statmath/math/maple/gettingstarted/printable.html (10 of 10) [3/30/2000 11:01:37 AM]

You might also like