Contents Previous Next Index

3 Worksheet Mode


The Worksheet mode of the Standard Worksheet interface is designed for:
•

Interactive use through Maple commands, which offers advanced functionality and customized control not available using the context panel or other syntaxfree methods

•

Programming using the powerful Maple language

Using Worksheet mode, you have access to all of the Maple features described in Chapter 1, and most of those described in Chapter 2, including:
For information on these features, see Chapter 1, Getting Started and Chapter 2, Document Mode.
Note: Using a document block, you can use all Document mode features in Worksheet mode. For information on document blocks, see Document Blocks.
Note: This chapter and the following chapters except Chapter 7 were created using Worksheet mode.

3.1 In This Chapter


Section

Topics

Input Prompt  Where you enter input


Commands Thousands of routines for performing computations and other operations

•

Lists of Common Commands and Packages


Palettes  Items that you can insert by clicking or dragging


The Context Panel Clickable access to common operations

•

Using the Context Panel


Assistants and Tutors Graphical interfaces with buttons and sliders

•

Launching Assistants and Tutors


Task Templates  Sets of commands with placeholders that you can insert and use to perform a task

•

Inserting a Task Template


Text Regions  Areas in the document in which you can enter text

•

Inserting a Text Region


Names  References to the expressions you assign to them


Equation Labels  Automatically generated labels that you can use to refer to expressions

•

Displaying Equation Labels

•

Referring to a Previous Result

•

Execution Groups with Multiple Outputs

•

Label Numbering Schemes

•

Features of Equation Labels






3.2 Input Prompt


In Worksheet mode, you enter input at the Maple input prompt (
). The default mode for input is Math mode (2D Math).
To evaluate input:
Maple displays the result (output) below the input.
For example, to find the value of $\mathrm{sin}{}^{3}\left(\frac{\mathrm{\π}}{3}\right)$, enter the expression, and then press Enter.
>

${\mathrm{sin}}^{3}\left(\frac{\mathrm{\pi}}{3}\right)$

$\frac{{3}{}\sqrt{{3}}}{{8}}$
 (3.1) 
For example, compute the sum of two fractions.
>

$\frac{2}{9}+\frac{7}{11}$

$\frac{{85}}{{99}}$
 (3.2) 
A set of Maple input and its output are referred to as an execution group.
In the worksheet, the semicolon as a statement terminator is optional.

Suppressing Output


To suppress the output, enter a colon (:) at the end of the input.
>

$a\u2254\frac{2}{9}+\frac{7}{11}\:$



1D Math Input


You can also insert input using 1D Math mode. The input is entered as a onedimensional sequence of characters. 1D Math input is red.
To enter input using 1D Math:
•

At the input prompt, press F5 or click the Text button in the context bar,
, to switch from 2D Math to 1D Math.

$\frac{{1785623}}{{120}}$
As with 2D math, in 1D math, if you use a colon, Maple suppresses the output.
>

${123}^{2}\frac{29857}{120}\:$

To set the default input mode at a prompt to 1D Math:
1.

From the Tools menu, select Options. The Options dialog is displayed.

2.

On the Display tab, in the Input display dropdown list, select Maple Notation.

3.

Click Apply to Session (to set for only the current session) or Apply Globally (to set for all Maple sessions).

To convert between 2D Math input and 1D Math input:
1.

Select the 2D (or 1D) Math input.

2.

From the Format menu, select Convert To, and then 1D Math Input (or 2D Math Input).



Input Separators


In 1D and 2D Math input, you can use a semicolon or colon to separate multiple inputs in the same input line.
${2.097617696}$
${0.05847385446}$
If you do not specify a semicolon or colon, Maple interprets it as a single input. This can either give unexpected results or an error. Notice that the following example gives an error in 1D math but in 2D math this is interpreted as multiplication.
>

$\sqrt{4.4}tan\left(3.2\right)$

${0.1226557919}$



3.3 Commands


Maple contains a large set of commands and a powerful programming language. Most Maple commands are written using the Maple programming language.
You can enter commands using 1D or 2D Math. 1D Math input is recommended when programming in Maple. Basic Programming provides an introduction to Maple programming.
To learn how to use Maple commands, see the appropriate help page, or use task templates. For more information, see The Maple Help System and Task Templates.

The Maple Library


Maple's commands are contained in the Maple library. There are two types of commands: toplevel commands and package commands.
•

The toplevel commands include many of the most frequently used Maple commands, as well as an extensive list of mathematical functions.

•

Packages contain related specialized commands in areas such as calculus, linear algebra, vector calculus, and code generation.

For a complete list of packages and commands, refer to the index/help help pages. For information on the Maple Help System, see The Maple Help System.


TopLevel Commands


To use a toplevel command, enter its name followed by parentheses (( )) containing any parameters. This is referred to as a calling sequence for the command.
Note: In 1D Math input, include a semicolon or colon at the end of the calling sequence.
For example, to differentiate an expression, use the diff command. The required parameters are the expression to differentiate, which must be specified first, and the independent variable.
>

$\mathrm{diff}\left(\mathrm{tan}\left(x\right)\mathrm{sin}\left(x\right)comma;x\right)$

$\left({1}{+}{{\mathrm{tan}}{}\left({x}\right)}^{{2}}\right){}{\mathrm{sin}}{}\left({x}\right){+}{\mathrm{tan}}{}\left({x}\right){}{\mathrm{cos}}{}\left({x}\right)$

Mathematical Functions


For a complete list of commands that implement mathematical functions, such as BesselI and AiryAi, available in the library, refer to the initialfunctions help page.
>

$\frac{\mathrm{BesselI}\left(0.1\,1\right)}{\mathrm{AiryAi}\left(2.2\right)}$

${47.53037086}$
For detailed information on the properties of a function, use the FunctionAdvisor command.
>

$\mathrm{FunctionAdvisor}\left(\'\mathrm{definition}\'\,\mathrm{BesselI}\right)$

$\left[{{I}}_{{a}}{}\left({z}\right){=}\frac{{{z}}^{{a}}{}{}_{{0}}{F}_{{1}}{}\left({;}{a}{+}{1}{;}\frac{{{z}}^{{2}}}{{4}}\right)}{{\mathrm{\Gamma}}{}\left({a}{+}{1}\right){}{{2}}^{{a}}}{\,}{\mathrm{with\; no\; restrictions\; on}}{}\left({a}{\,}{z}\right)\right]$
This definition is displayed using the typeset form of the BesselI function, the hypergeometric function (hypergeom) and the Gamma function (GAMMA). To see the function names rather than the typeset form, use lprint:
>

$\mathrm{lprint}\left(\%\right)$

[BesselI(a, z) = z^a*hypergeom([], [a+1], (1/4)*z^2)/(GAMMA(a+1)*2^a), `with no restrictions on `(a, z)]
 
For detailed information on how to use a function in Maple, refer to its help page.
For example:
>

$\?\mathrm{Bessel}$

Another way to access help is to select the word for which you want help and use the shortcut key for context help, F2 (Control + Shift + ?, for Mac).


Top Commands


Here are a few of the most frequently used Maple commands. A complete list of toplevel commands is available on the index/function help page.
Table 3.1: Top Commands 
Command Name

Description

plot and plot3d

Create a twodimensional and threedimensional plot of functions.

solve

Solve one or more equations or inequalities for their unknowns.

fsolve

Solve one or more equations using floatingpoint arithmetic.

eval

Evaluate an expression at a given point.

evalf

Numerically evaluate expressions.

dsolve

Solve ordinary differential equations (ODEs).

int

Compute an indefinite or definite integral.

diff

Compute an ordinary or partial derivative, as the context dictates.

limit

Calculate the limiting value of a function.

sum

For symbolic summation. It is used to compute a closed form for an indefinite or definite sum.

assume/is

Set variable properties and relationships between variables. Similar functionality is provided by the assuming command.

assuming

Compute the value of an expression under assumptions.

simplify

Apply simplification rules to an expression.

factor

Factor a polynomial.

expand

Distribute products over sums.

normal

Normalize a rational expression.

convert

Convert an expression to a different type or form.

type

Typechecking command. In many contexts, it is not necessary to know the exact value of an expression; it suffices to know that an expression belongs to a broad class, or group, of expressions that share some common properties. These classes or groups are known as types.

series

Generalized series expansion.

map

Apply a procedure to each operand of an expression.





Package Commands


To use a package command, the calling sequence must include the package name, and the command name enclosed in square brackets ([ ]).
package[command](arguments)



If you are frequently using the commands in a package, load the package.
To load a package:
•

Use the with command, specifying the package as an argument.

The with command displays a list of the package commands loaded (unless you suppress the output by entering a colon at the end of the calling sequence).
After loading a package, you can use the short form names of its commands. That is, you can enter the commands without specifying the package name.
For example, use the NLPSolve command from the Optimization package to find a local minimum of an expression and the value of the independent variable at which the minimum occurs.
>

$\mathrm{Optimization}\left[\mathrm{NLPSolve}\right]\left(\frac{\mathrm{sin}\left(x\right)}{x}\,x\=1..15\right)$

$\left[{\mathrm{0.0913252028230577}}{\,}\left[{x}{=}{10.9041216489198}\right]\right]$
>

$\mathrm{with}\left(\mathrm{Optimization}\right)\;$

$\left[{\mathrm{ImportMPS}}{\,}{\mathrm{Interactive}}{\,}{\mathrm{LPSolve}}{\,}{\mathrm{LSSolve}}{\,}{\mathrm{Maximize}}{\,}{\mathrm{Minimize}}{\,}{\mathrm{NLPSolve}}{\,}{\mathrm{QPSolve}}\right]$
>

$\mathrm{NLPSolve}\left(\frac{\mathrm{sin}\left(x\right)}{x}\,x\=1..15\right)$

$\left[{}{0.0913252028230576718}{\,}\left[{x}{\=}{10.9041216700744900}\right]\right]$
For more information on optimization, see Optimization.
To unload a package:
•

Use the unwith command, specifying the package as an argument.

>

$\mathrm{unwith}\left(\mathrm{Optimization}\right)$

Alternatively, use the restart command. The restart command clears Maple's internal memory. The effects include unassigning all names and unloading all packages. For more information, refer to the restart help page.
Some packages contain commands that have the same name as a toplevel command. For example, the plots package contains a changecoords command. Maple also contains a toplevel changecoords command.
>

$\mathrm{with}\left(\mathrm{plots}\right)\:$

After the plots package is loaded, the name changecoords refers to the plots[changecoords] command. To use the toplevel changecoords command, unload the package or use the restart command. (For alternative methods of accessing the toplevel command, see the rebound help page.)

Top Packages


Here are a few of the most frequently used Maple packages. A complete list of packages is available on the index/package help page.
Table 3.2: Top Packages 
Package Name

Description

CodeGeneration

The Code Generation package is a collection of commands and subpackages that enable the translation of Maple code to other programming languages, such as C, C#, Fortran, MATLAB^{®}, Visual Basic^{®}, Java^{TM}, Julia, Perl, and Python^{®}.

LinearAlgebra

The Linear Algebra package contains commands to construct and manipulate Matrices and Vectors, and solve linear algebra problems. LinearAlgebra routines operate on three principal data structures: Matrices, Vectors, and scalars.

Optimization

The Optimization package is a collection of commands for numerically solving optimization problems, which involve finding the minimum or maximum of an objective function possibly subject to constraints.

Physics

The Physics package implements computational representations and related operations for most of the objects used in mathematical physics computations.

RealDomain

The Real Domain package provides an environment in which Maple assumes that the basic underlying number system is the field of real numbers instead of the complex number field.

ScientificConstants

The Scientific Constants package provides access to the values of various physical constants, for example, the velocity of light and the atomic weight of sodium. This package provides the units for each of the constant values, allowing for greater understanding of an equation. The package also provides unitsmatching for error checking of the solution.

ScientificErrorAnalysis

The Scientific Error Analysis package provides representation and construction of numerical quantities that have a central value and an associated uncertainty (or error), which is a measure of the degree of precision to which the quantity's value is known. Various firstorder calculations of error analysis can be performed with these quantities.

Statistics

The Statistics package is a collection of tools for mathematical statistics and data analysis. The package supports a wide range of common statistical tasks such as quantitative and graphical data analysis, simulation, and curve fitting.

Student

The Student package is a collection of subpackages designed to assist with teaching and learning standard undergraduate mathematics. The many commands display functions, computations, and theorems in various ways, including stepping through important computations.
The Student package contains the following subpackages:
•

Basics  fundamental math concepts


Units

The Units package contains commands for unit conversion and provides environments for performing calculations with units. It accepts approximately 300 distinct unit names (for example, meters and grams) and over 550 units with various contexts (for example, standard miles and U.S. survey miles). Maple also contains two Units palettes that allow you to enter the unit for an expression quickly.

VectorCalculus

The Vector Calculus package is a collection of commands that perform multivariate and vector calculus operations. A large set of predefined orthogonal coordinate systems is available. All computations in the package can be performed in any of these coordinate systems. It contains a facility for adding a custom but orthogonal coordinate system and using that new coordinate system for your computations.






3.4 Palettes


Palettes are collections of related items that you can insert by clicking or dragging. For example, see Figure 3.1.

Figure 3.1: Calculus Palette



You can use palettes to enter input.
For example, evaluate a definite integral using the definite integration item
in the Calculus palette.
In 2D Math, clicking the definite integration item inserts:
>

${\int}_{{{{x}}_{{1}}}_{}}^{{{{x}}_{{2}}}_{}}{f}\phantom{\rule[0.0ex]{0.5em}{0.0ex}}\ⅆ{x}$

1.

Enter values in the placeholders. To move to the next placeholder, press Tab.

2.

To evaluate the integral, press Enter.

>

${\int}_{0}^{1}\mathrm{tanh}\left(x\right)\phantom{\rule[0.0ex]{0.5em}{0.0ex}}\ⅆx$

${}{\mathrm{ln}}{}\left({2}\right){\+}{\mathrm{ln}}{}\left({{\ⅇ}}^{{}{1}}{\+}{\ⅇ}\right)$
In 1D Math, clicking the definite integration item inserts the corresponding command calling sequence.
Specify the problem values (using the Tab to move to the next placeholder), and then press Enter. Note: If pressing the Tab key inserts a tab, under the Format menu, toggle Tab Navigation. Then the Tab key will move the cursor to the next placeholder.
>

int(tanh(x), x = 0..1);

${}{\mathrm{ln}}{}\left({2}\right){\+}{\mathrm{ln}}{}\left({{\ⅇ}}^{{}{1}}{\+}{\ⅇ}\right)$
Note: Some palette items cannot be inserted into 1D Math because they are not defined in the Maple language. When the cursor is in 1D Math input, unavailable palette items are dimmed.
For more information on viewing and using palettes, see Palettes in Chapter 1.


3.5 The Context Panel


The context panel is a collection of tools and operations that are appropriate for a particular expression. The context panel changes according to the expression, table, or region that you click on. See Figure 3.2.

Figure 3.2: Integer Context Panel



You can use the context panel to perform operations on 2D Math, including output.
To use the context panel:
2.

Move your mouse cursor over Pin Open Context Panel (
), or click it to fix the context panel in place.

3.

From the context panel, select a tool or operation.

Maple inserts a new execution group containing:
•

The calling sequence that performs the operation

•

The result of the operation


Example  Using the Context Panel


Determine the rational expression (fraction) that approximates the floatingpoint number $0.3463678+1.7643$.
Action

Result in Document

1.

Enter and execute the expression.



2.

Click the output floatingpoint number.



3.

From the context panel, select Conversions → Rational. The inserted calling sequence includes an equation label reference to the number you are converting.


>

$\mathrm{convert}\left(\,\'\mathrm{rational}\'\right)$

$\frac{{32270}}{{15289}}$



Notice that an equation label reference has been used. For information on equation labels and equation label references, see Equation Labels.
For more information on the Context Panel, see Computing with the Context Panel in Chapter 2.



3.6 Assistants and Tutors


Assistants and tutors provide pointandclick interfaces with buttons, text input regions, and sliders. See Figure 3.3.

Figure 3.3: ODE Analyzer Assistant




Launching an Assistant or Tutor


To launch an assistant or tutor:
2.

Select Assistants or Tutors.

3.

Navigate to and select one of the assistants or tutors.

For more information on assistants and tutors, see Assistants in Chapter 1.



3.7 Task Templates


Maple can solve a diverse set of problems. The task template facility helps you quickly find and use the commands required to perform common tasks.
After inserting a task template, specify the parameters of your problem in the placeholders, and then execute the commands, or click a button.
The Task Browser (Figure 3.4) organizes task templates by subject.
To launch the Task Browser:
•

From the Tools menu, select Tasks, and then Browse.

You can also browse the task templates in the Table of Contents of the Maple Help System.

Figure 3.4: Task Browser



For details on inserting and using task templates, see Task Templates. You can also create your own task templates for performing common tasks. For details, refer to the creatingtasks help page.


3.8 Text Regions


To add descriptive text in Worksheet mode, use a text region.
To insert a text region:
•

In the toolbar, click the Text region icon
.

The default mode in a text region is Text mode.
In a text region, you can:
•

Enter text with inline mathematical content by switching between Text and Math modes. To toggle between Text mode and Math mode, press F5 or click the Math and Text toolbar icons,
Note: To change a math region to nonexecutable mathematical content, use Shift + F5.

•

Insert any palette item. Palette items are inserted in Math mode (2D Math). Note: After you insert a palette item, you must press F5 or click the toolbar icon to return to Text mode.

You can format text in a text region. Features include:
•

Sections and subsections

For more information on formatting documents, see Creating Mathematical Documents.


3.9 Names


Instead of reentering an expression every time you need it, you can assign it to a name or add an equation label to it. Then you can quickly refer to the expression using the name or an equation label reference. For information on labels, see the following section, Equation Labels.
Note: Through the Variable Manager you can manage the toplevel assigned variables currently active in your Maple Session. For more information about the Variable Manager, see the Variable Manager help page. For Maple workbooks, you can use the Variable Manager palette to return to the saved state of your variables.

Assigning to Names


You can assign any Maple expression to a name: numeric values, data structures, procedures (a type of Maple program), and other Maple objects.
Initially, the value of a name is itself.
${a}$
The assignment operator (:=) associates an expression with a name.
${a}{\u2254}{\mathrm{\pi}}$
Recall that you can enter $\pi$ using the following two methods.
•

Use the Common Symbols palette.

When Maple evaluates an expression that contains a name, it replaces the name with its value. For example:
>

$\mathrm{cos}\(a\)$

${\mathrm{1}}$
For information on Maple evaluation rules, see Evaluating Expressions.

Mathematical Functions


To define a function, assign it to a name.
For example, define a function that computes the cube of its argument.
>

$\mathrm{cube}:=x\to {x}^{3}\:$

For information on creating functions, see Example 2  Define a Mathematical Function.
>

$\mathrm{cube}\left(3\right)\;\mathrm{cube}\left(1.666\right)$

${27}$
${4.624076296}$
Note: To insert the right arrow, enter the characters >. In 2D Math, Maple replaces > with the right arrow symbol$\to \.$ In 1D Math, the characters are not replaced.
For example, define a function that squares its argument.
${1024}$
For more information on functions, see Functional Operators.


Protected Names


Protected names are valid names that are predefined or reserved.
If you attempt to assign to a protected name, Maple returns an error.
For more information, refer to the type/protected and protect help pages.



Unassigning Names right single


To unassign a name, reset the value of a name to itsef. Right single quotes (unevaluation quotes) prevent Maple from evaluating the name.
>

$a\u2254\'a\'$

You can also use the unassign command. You must enclose the name in right single quotes (' ').
>

$\mathrm{unassign}\left(\'a\'\right)$

${a}$
For more information on the uses of unevaluation quotes, see Delaying Evaluation or refer to the uneval help page.
Unassigning all names:
The restart command clears Maple's internal memory. The effects include unassigning all names. For more information, refer to the restart help page.


Valid Names


A Maple name must be one of the following.
•

A sequence of alphanumeric and underscore (_) characters that begins with an alphabetical character.

•

A sequence of characters enclosed in left single quotes (` `).

Important: Do not begin a name with an underscore character. Maple reserves names that begin with an underscore for use by the Maple library.
Examples of valid names:
•

polynomial1_divided_by_polynomial2




3.10 Equation Labels


Maple marks the output of each execution group with a unique equation label.
Note: The equation label is displayed to the right of the output.
>

$\int \mathrm{sin}\left(x\right)\phantom{\rule[0.0ex]{0.5em}{0.0ex}}\ⅆx$

${}{\mathrm{cos}}{}\left({x}\right)$
 (3.4) 
Using equation labels, you can refer to the result in other computations.
>

$\int \phantom{\rule[0.0ex]{0.5em}{0.0ex}}\ⅆx$

${}{\mathrm{sin}}{}\left({x}\right)$
 (3.5) 

Displaying Equation Labels


Important: By default, equation labels are displayed. If equation label display is turned off, complete both of the following operations.
•

From the Format menu, select Equation Labels, and then ensure that Worksheet is selected.

•

In the Options dialog (Tools→Options), on the Display tab, ensure that Show equation labels is selected.



Inserting Equation Labels


Instead of reentering previous results in computations, you can use equation label references. Each time you need to refer to a previous result, insert an equation label reference.
You can insert equation labels by:
•

Positioning your cursor where you want to insert the equation label, then doubleclick on the equation label you want to insert.

•

Using the Label option from the Insert menu (or using the CTRL+L shortcut keys).

Insert an equation label reference using the doubleclick method:
1.

Position your cursor where you want to insert the equation label.

2.

Doubleclick on the equation label you want to insert into your expresion.

3.

The equation label is inserted into the expression at the location you selected.

Insert an equation label reference using the Insert menu:
1.

From the Insert menu, select Label. Alternatively, doubleclick on the equation label (to the far right side of the output) or press Ctrl+L; Command+L, Macintosh.

2.

In the Insert Label dialog (see Figure 3.5), enter the label value, and then click OK.


Figure 3.5: Insert Label Dialog



Maple inserts the reference.
To integrate the product of (3.4) and (3.5):
Action

Result in Document

1.

In the Expression palette, click the indefinite integration item
. The item is inserted and the integrand placeholder is highlighted.



2.

Press Ctrl+L (Command+L, for Macintosh).

3.

In the Insert Label dialog, enter 3.4. Click OK.



5.

Press Ctrl+L (Command+L, for Macintosh).

6.

In the Insert Label dialog, enter 3.5. Click OK.



7.

To move to the variable of integration placeholder, press Tab.

9.

To evaluate the integral, press Enter.


>

$\int \cdot DifferentialD;x$

$\frac{{{\mathrm{sin}}{}\left({x}\right)}^{{2}}}{{2}}$
 (3.6) 





Execution Groups with Multiple Outputs


An equation label is associated with the last output within an execution group.
>

${\left(\frac{2}{3.5}\right)}^{2}\;\mathrm{cos}\left(\frac{\pi}{6}\right)$

$\frac{{1}}{{2}}{}\sqrt{{3}}$
 (3.7) 


Label Numbering Schemes


You can number equation labels in two ways:
•

Flat  Each label is a single number, for example, 1, 2, or 3.

•

Sections  Each label is numbered according to the section in which it occurs. For example, 2.1 is the first equation in the second section, and 1.3.2 is the second equation in the third subsection of the first section.

To change the equation label numbering scheme:
•

From the Format menu, select Equation Labels → Label Display. In the Format Labels dialog (Figure 3.6), select one of the formats.

•

Optionally, enter a prefix.


Figure 3.6: Format Labels Dialog: Adding a Prefix





Features of Equation Labels


Although equation labels are not descriptive names, labels offer other important features.
•

Each label is unique, whereas a name may be inadvertently assigned more than once for different purposes.

•

Maple labels the output values sequentially. If you remove or insert an output, Maple automatically renumbers all equation labels and updates the label references.

•

If you change the equation label format (see Label Numbering Schemes), Maple automatically updates all equation labels and label references.

For information on assigning to, using, and unassigning names, see Names.
For more information on equation labels, refer to the equationlabels help page.
The following chapters describe how to use Maple to perform tasks such as solving equations, producing plots and animations, and creating mathematical documents. The chapters were created using Worksheet mode. Except where noted, all features are available in both Worksheet mode and Document mode.



Contents Previous Next Index
