Sunteți pe pagina 1din 2

Maple Packages 20/04/2015 8:59 pm

Lesson 2 - Maple Functions

Maple Packages
Most Maple functions are stored in "packages" that you must tell Maple to load before you can use those functions. A Maple package
can also extend Maple's abilities in other ways, for example by

defining new types of plotting commands (e.g. the "plots" package)


extending the types of data Maple can handle (e.g. the "ExcelTools" package)
providing an interface to another application (e.g. the "Matlab" package).

If a function belongs in a package this will be shown on its help page.

Loading a Maple package

Maple packages are loaded using the command "with".

The main packages you will be using in this course are the "LinearAlgebra" package for linear algebra and the "plots" package for
plotting graphs. These will be discussed in more detail in other learning modules.

A common mistake made by students in first year is to forget to load a package before trying to use a function from that package.

For a complete list of Maple's packages see the Maple package


index by typing

You can see that there are many Maple packages covering a
> ?index,package wide variety of topics. There are even more packages
available from third parties.
Before we look at an example, let's do a restart just to
be on the safe side.

We'll need to use x, y and z as unassigned variables -- a


> restart; restart ensures that x, y and z are unassigned since it clears
all variables.
Now load the plots package.

You will see a list of all the functions in this package.


> with(plots); Usually, you want to suppress this list, so use a colon
instead of a semicolon. Try this command again using a
Notice that "implicitplot3d" is in the list of functions colon at the end, i.e. "with(plots):" to see the difference.
loaded from this package. You won't need to know how
to use this -- just use the mouse to copy the following commands
into Maple to see it in action. There will be more about plotting
later.

You should see a 3d plot of the


> eqn := x^3+y^3+z^3+1 = (x+y+z+1)^3; points satisfying the equation
x3+y3+z3 = (x+y+z)3.
> ranges := x=-2..2, y=-2..2, z=-2..2;
If you click and hold the left
mouse button on the plot,
> opts := grid=[20,20,20], axes=boxed; moving the mouse will rotate the
plot.

> implicitplot3d(eqn, ranges, opts);

The help page of a function indicates that it is part of a package.


To see how it does this look up the help page for "implicitplot3d"
using

At the top of the help page is the heading in bold


> ?implicitplot3d

http://moodle.telt.unsw.edu.au/file.php/12406/Maple/MapleSelfPaced/lesson2/Lesson2_maplePackages.html Page 1 of 2
Maple Packages 20/04/2015 8:59 pm

"plots[implicitplot3d]". This indicates that it is part of the


plots package.

Summary Self-test Exercise


Many Maple functions are only available after you have Look up the Maple help page for the function
loaded the package that contains them. "GetConstant".

To load a package, use the "with" command. For What package is this a part of?
example "with(LinearAlgebra):"
Answer: The ScienticConstants package.
A very common mistake is to forget to load a package Use the mouse to select the text between the word
when it is needed. "Answer" and here to see the answer.

http://moodle.telt.unsw.edu.au/file.php/12406/Maple/MapleSelfPaced/lesson2/Lesson2_maplePackages.html Page 2 of 2

S-ar putea să vă placă și