Part 3: Commands and Packages
Go to Maple Portal Previous Tutorial Next Tutorial

Introduction


Maple Tutorials are designed to help you get started with Maple, learn about the key tools available in Maple, and lead you through a series of problems.
In Part 3: Commands and Packages, you will learn more about Maple toplevel commands and about how to use packages. You will also learn to use the help system.
To try this material on your own, start with an empty Maple document. Perform the steps described in the left column of each table below. The results of the steps are displayed in the right column for reference.
Refer to Help>Quick Reference for basic getting started tips.
Note for nonWindows users: The keystrokes given in this document are for Windows. There will be differences for other platforms. If you are using a different platform, see Shortcut Keys.


Using Top Commands and Packages


Maple has over 4000 commands that provide comprehensive, indepth coverage of a vast range of mathematical and programming topics. In the tutorials 1Talking to Maple and 2Putting Your Ideas Together, you have already seen a number of Maple commands, including sin, taylor, int, exp, dsolve, solve, fsolve, rhs, and eval, and accessed many more behindthescenes using contextsensitive options. The Context Panel and interactive assistants all use useraccessible Maple commands to perform their tasks. Some Maple commands are toplevel commands while others are organized into packages.

Maple Commands


Frequently, general purpose commands are available at the top level, and can be accessed at any time. In addition to the command listed above, top level commands include trigonometric and special functions and commands for expression manipulation such as factor, expand, and simplify. To view the extensive list of toplevel functions in Maple, see Index of Functions.
Tip: Most Maple commands are written in the Maple language, but a small collection are built into the compiled Maple kernel. Some of the commands you have already seen are builtin commands, such as taylor, rhs, and eval. Other useful builtin commands are shown in the following table.
Useful and Efficient Commands

Examples

evalf  evaluate using floatingpoint arithmetic

$\mathrm{ln}\left(2\right)$ = ${\mathrm{ln}}{}\left({2}\right)$${}$
$\mathrm{evalf}\left(\mathrm{ln}\left(2\right)\right)$ = ${0.6931471806}$${}$
${}$

evalb evaluate as a Boolean expression

$\mathrm{evalb}\left(11\>0\right)$ = ${\mathrm{false}}$${}$
$a\u22542\:$
$b\u22542\:$
$\mathrm{evalb}\left(a\=b\right)$ = ${\mathrm{true}}$${}$
${}$
${}$

sort  sort a list of values or a polynomial

$\mathrm{sort}\left(\left[2\,1comma;3comma;1\right]\right)$ = $\left[{1}{\,}{1}{\,}{2}{\,}{3}\right]$${}$
$\mathrm{sort}\left(1\+2{x}^{4}plus;3xplus;{x}^{3}\right)$ = ${2}{}{{x}}^{{4}}{\+}{{x}}^{{3}}{\+}{3}{}{x}{\+}{1}$${}$
${}$

seq  create a sequence

$\mathrm{seq}\left(1..4\right)$ = ${1}{\,}{2}{\,}{3}{\,}{4}$${}$
$\mathrm{seq}\left({i}^{3}\,i\=1..4\right)$ = ${1}{\,}{8}{\,}{27}{\,}{64}$${}$
${}$

map  apply a procedure to each operand of an expression
zip  zip together two data sets by applying a binary function to the components of the two data sets
The function iquo returns the quotient of two integers.

$\mathrm{map}\left(\mathrm{ln}\,\left[1\,2\,3\,4\right]\right)$ = $\left[{0}{\,}{\mathrm{ln}}{}\left({2}\right){\,}{\mathrm{ln}}{}\left({3}\right){\,}{2}{}{\mathrm{ln}}{}\left({2}\right)\right]$${}$
${}$
$\mathrm{zip}\left(\mathrm{iquo}\,\left[207\,241\,345\,1235\right]comma;\left[17comma;21comma;30comma;44\right]\right)$ = $\left[{12}{\,}{11}{\,}{11}{\,}{28}\right]$${}$
${}$

select, remove, and selectremove  selection or removal from an expression
Those elements which satisfy the Booleanvalued command are returned. Here, we use the Booleanvalued command issqr, which tests if an integer is a perfect square.

$\mathrm{select}\left(\mathrm{issqr}\,\left\{42\,53comma;64\right\}\right)$ = $\left\{{64}\right\}$${}$
${}$
${}$

indets  find the indeterminates of an expression
Expressions such as ${\ⅇ}^{y}$ are considered indeterminates. Use the type `name` to return only variable names.

$\mathrm{indets}\left(x\cdot y\+zx\cdot {\ⅇ}^{y}\right)$ = $\left\{{x}{\,}{y}{\,}{z}{\,}{{\ⅇ}}^{{y}}\right\}$${}$
$\mathrm{indets}\left(x\cdot y\+zx\cdot {\ⅇ}^{y}\,\mathrm{name}\right)$ = $\left\{{x}{\,}{y}{\,}{z}\right\}$${}$
${}$



The tutorial 6Data Structures includes more examples using some of these commands. For a list of commands implemented in the kernel, see index/builtin.


Using Packages


Maple also contains packages, which are collections of commands. Some top Maple packages are listed in the table.
Package

Purpose

CodeGeneration

tools for translating Maple code to other languages

combinat

combinatorial functions, including commands for calculating permutations and combinations of lists and partitions of integers

CurveFitting

commands that support curvefitting

DEtools

tools for manipulating, solving, and plotting systems of differential equations

DiscreteTransforms

commands for computing transforms of discrete data

DynamicSystems

commands for creating, manipulating, simulating, and plotting linear systems objects

LinearAlgebra

commands for manipulating Matrices and Vectors and performing Linear Algebra

Optimization

commands for numerically solving optimization theory problems

plots

commands for displaying graphical representations

Statistics

tools for mathematical statistics and data analysis

StringTools

optimized commands for string manipulation



For a full list of Maple packages, see Index of Packages.
There are two ways to use the commands in a package: by using the long form or short form of their calling sequences.
•

Long form: The commands in a package can always be accessed using the long form of the calling sequence. This form is PackageName[CommandName].

•

Short form: The short form of the calling sequence for all commands in a package can be used during the current Maple session after with(PackageName) has been entered. The short form is simply CommandName.

Steps

Result

Example:
Use the Minimize command from the Optimization package to minimize $4\cdot {x}^{2}\mathrm{ln}\left(x\right)$, given the initial point $x\=.5$.
First, we will use the long form by calling Optimization[Minimize].
The minimum is given, followed by the $x$value for which this minimum is attained.

${}$
${}$
${}$
$\mathrm{expr}\u22544\cdot {x}^{2}\mathrm{ln}\left(x\right)\:$
$\mathrm{Optimization}\left[\mathrm{Minimize}\right]\left(\mathrm{expr}\,\mathrm{initialpoint}\=\left\{x\=.5\right\}\right)$
$\left[{1.53972077083991810}{\,}\left[{x}{\=}{0.353553390618445984}\right]\right]$
 (2.2.1) 
${}$

Now, enter with(Optimization).
A list of all the commands in the package is returned. (To suppress the display of this list, use a colon (:) after this command.)
Now, all these commands can be used by just entering the command name. This is the short form of the calling sequence.
Example:
Redo the problem, using the short form.
Tip: Packages can also be loaded from the Tools menu.

$\mathrm{with}\left(\mathrm{Optimization}\right)$
$\left[{\mathrm{ImportMPS}}{\,}{\mathrm{Interactive}}{\,}{\mathrm{LPSolve}}{\,}{\mathrm{LSSolve}}{\,}{\mathrm{Maximize}}{\,}{\mathrm{Minimize}}{\,}{\mathrm{NLPSolve}}{\,}{\mathrm{QPSolve}}\right]$
 (2.2.2) 
${}$
${}$
${}$
${}$
${}$
${}$
${}$
$\mathrm{Minimize}\left(\mathrm{expr}\,\mathrm{initialpoint}\=\left\{x\=.5\right\}\right)$
$\left[{1.53972077083991810}{\,}\left[{x}{\=}{0.353553390618445984}\right]\right]$
 (2.2.3) 
${}$



For more information on these two methods of accessing package commands, see Using Packages.



Getting Help


Maple has an extensive help system, including help pages, online manuals, examples, and an integrated dictionary of mathematical and engineering terms.
Steps

Useful for

Select the Help>Maple Help menu to display the help browser. (You can also open Maple Help by pressing [F1].)
Enter the topic name (such as "integral") into the search box. Click Search. The int help page opens.
You can copy and paste the examples section to your document. From the Edit menu, select Copy Examples. In your document, choose Edit>Paste. (These options are also available from the rightclick menu.)
By default, examples are displayed in 2D math. To view the examples in 1D math, click the
button to toggle the display.

Search and browse full help system, including help pages, dictionary, and manuals.
From the help page, you can see the calling sequences, read the description, and view examples.
If you copy the examples to your document, you can then modify and execute the examples.

Within a document, there are two easy ways to get help on a topic:
1.

To get help on a particular topic, use the ? notation. For example, type ?solve [Enter] in math mode.

2.

For information on a topic name that already appears in your document, place the cursor on the word and press [F2].

Example: Place the cursor on the word Optimization and press [F2].

Instant access to the help page when you know the topic name or command name.
$\?\mathrm{solve}$
The Minimize command is found in the Optimization package.

Help > Quick Reference (or [Ctrl][F2])

Basic overview of important topics.

?examples,index

Example worksheets illustrating different mathematical and programming commands. These worksheets will open in a new tab in your Maple window.

Tools>Task>Browse for task templates.

Fillintheblank templates organized by concept.

Access Maple's manuals through the help system. Select the Help>Maple Help menu to display the help browser.
Next, in the Table of Contents tab, expand the Manuals directory to access the User Manual or Programming Guide.
PDFs from the Maplesoft web site provide other format options for Maple's manuals. Visit the Maplesoft Documentation Center, http://www.maplesoft.com/documentation_center.

Conceptual overviews as well as more indepth explanation.




Go to Maple Portal Previous Tutorial Next Tutorial
