Part 3: Commands and Packages - Maple Programming Help

Home : Support : Online Help : Getting Started : Tutorials : MaplePortal/Tutorial3

Part 3: Commands and Packages

Using Top Commands and Packages

Maple has over 4000 commands that provide comprehensive, in-depth coverage of a vast range of mathematical and programming topics.  In the tutorials 1-Talking to Maple and 2-Putting 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 behind-the-scenes using context-sensitive options.  The Context Panel and interactive assistants all use user-accessible Maple commands to perform their tasks. Some Maple commands are top-level 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 top-level 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 built-in commands, such as taylor, rhs, and eval.   Other useful built-in commands are shown in the following table.

 Useful and Efficient Commands Examples evalf - evaluate using floating-point 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≔2:$ $b≔2:$ $\mathrm{evalb}\left(a=b\right)$ = ${\mathrm{true}}$   sort - sort a list of values or a polynomial = $\left[{1}{,}{1}{,}{2}{,}{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]$   = $\left[{12}{,}{11}{,}{11}{,}{28}\right]$  select, remove, and selectremove - selection or removal from an expression   Those elements which satisfy the Boolean-valued command are returned.  Here, we use the Boolean-valued command issqr, which tests if an integer is a perfect square. = $\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+z-x\cdot {ⅇ}^{y}\right)$ = $\left\{{x}{,}{y}{,}{z}{,}{{ⅇ}}^{{y}}\right\}$ $\mathrm{indets}\left(x\cdot y+z-x\cdot {ⅇ}^{y},\mathrm{name}\right)$ = $\left\{{x}{,}{y}{,}{z}\right\}$ 

The tutorial 6-Data 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 curve-fitting 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}≔4\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.

$\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 right-click menu.)

By default, examples are displayed in 2-D math.  To view the examples in 1-D 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.

Fill-in-the-blank 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 in-depth explanation.