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 context menus 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


Context Menus Popup menus of common operations


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{\pi}{3}\right)$

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

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

$\frac{{85}}{{99}}$
 (3.2) 

Suppressing Output


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

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

A set of Maple input and its output are referred to as an execution group.


1D Math Input


You can also insert input using Text mode (1D Math). 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 toolbar,
, to switch from 2D Math to 1D Math.

$\frac{{1785623}}{{120}}$
Important: 1D Math input must end with a semicolon or colon. If you use a semicolon, Maple displays the output; if you use a colon, Maple suppresses the output.
To set the default input mode 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 2D Math input to 1D Math input:
1.

Select the 2D Math input.

2.

From the Format menu, select Convert To, and then 1D Math Input.

Important: In Document mode, you can execute a statement only if you enter it in Math mode.


Input Separators


In 1D and 2D Math input, you can use a semicolon or colon to separate multiple inputs in the same input line.
>

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

${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, as below, or an error.
>

$\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. You must use 1D Math input 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 are the most frequently used Maple commands.

•

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 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)$
For a complete list of functions (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[{\mathrm{BesselI}}{}\left({a}{\,}{z}\right){\=}\frac{{{z}}^{{a}}{}{\mathrm{hypergeom}}{}\left(\left[{}\right]{\,}\left[{1}{\+}{a}\right]{\,}\frac{{1}}{{4}}{}{{z}}^{{2}}\right)}{{\mathrm{\Γ}}{}\left({1}{\+}{a}\right){}{{2}}^{{a}}}{\,}{\mathrm{with\; no\; restrictions\; on}}{}\left({a}{\,}{z}\right)\right]$
For detailed information on how to use a function in Maple, refer to its help page.
For example:
>

$\?\mathrm{Bessel}$

Note: In 1D and 2D Math input, when accessing a help page using ?, you do not need to include a trailing semicolon or colon.

Top Commands


Here are a few of the most frequently used Maple commands. A complete list of toplevel commands is available at Help → Manuals, Resources, and more → List of Commands.
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[{}{0.0913252028230576718}{\,}\left[{x}{\=}{10.9041216700744900}\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 in the Maple help system at Help → Manuals, Resources, and more → List of Packages.
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}, 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:

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. Note: If pressing the Tab key inserts a tab, click the Tab icon
in the toolbar.

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.
>

int(int(f,x=a..b);,x=x[1]..x[2]);

Specify the problem values (using the Tab to move to the next placeholder), and then press Enter.
>

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 Context Menus


A context menu is a popup menu that lists the operations and actions you can perform on a particular expression. See Figure 3.2.

Figure 3.2: Integer Context Menu



In Worksheet mode, you can use context menus to perform operations on 2D Math and output.
To use a context menu:
1.

Rightclick (Controlclick, for Macintosh) the expression. The context menu is displayed.

2.

From the context menu, select an operation.

Maple inserts a new execution group containing:
•

The calling sequence that performs the operation

•

The result of the operation


Example  Using Context Menus


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.

Rightclick (Controlclick, for Macintosh) the output floatingpoint number.



3.

From the context menu, 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 context menus, see Context Menus 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: The mathematical content in a text region is not evaluated. To enter mathematical content that is evaluated, enter it at an Input Prompt.

•

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.

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}{:=}{\mathrm{\π}}$
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\)$

${}{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.
Error, attempting to assign to `sin` which is protected
 
For more information, refer to the type/protected and protect help pages.



Unassigning Names


The unassign command resets the value of a name to itself. Note: You must enclose the name in right single quotes (' ').
>

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

${a}$
Right single quotes (unevaluation quotes) prevent Maple from evaluating the name. For more information on unevaluation quotes, see Delaying Evaluation or refer to the uneval help page.
See also Unassigning a Name Using Unevaluation Quotes.
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.



Referring to a Previous Result


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.
To insert an equation label reference:
1.

From the Insert menu, select Label. (Alternatively, 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.
For example:
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{{1}}{{2}}{}{{\mathrm{cos}}{}\left({x}\right)}^{{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 equationlabel 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
