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 syntax-free 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:
Math and Text modes
The context panel
Assistants and tutors
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
Input Prompt - Where you enter input
The Input Prompt (>)
2-D and 1-D Math Input
Commands - Thousands of routines for performing computations and other operations
The Maple Library
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
Viewing Task Templates
Inserting a Task Template
Performing the Task
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
Assigning to Names
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 (2-D Math).
To evaluate input:
Maple displays the result (output) below the input.
For example, to find the value of sin⁡3π3, enter the expression, and then press Enter.
For example, compute the sum of two fractions.
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.
To suppress the output, enter a colon (:) at the end of the input.
1-D Math Input
You can also insert input using 1-D Math mode. The input is entered as a one-dimensional sequence of characters. 1-D Math input is red.
To enter input using 1-D Math:
At the input prompt, press F5 or click the Text button in the toolbar,
, to switch from 2-D Math to 1-D Math.
123^2 - 29857/120;
As with 2-D math, in 1-D math, if you use a colon, Maple suppresses the output.
To set the default input mode at a prompt to 1-D Math:
From the Tools menu, select Options. The Options dialog is displayed.
On the Display tab, in the Input display drop-down list, select Maple Notation.
Click Apply to Session (to set for only the current session) or Apply Globally (to set for all Maple sessions).
To convert between 2-D Math input and 1-D Math input:
Select the 2-D (or 1-D) Math input.
From the Format menu, select Convert To, and then 1-D Math Input (or 2-D Math Input).
In 1-D and 2-D Math input, you can use a semicolon or colon to separate multiple inputs in the same input line.
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 1-D math but in 2-D math this is interpreted as multiplication.
Error, missing operator or `;`
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 1-D or 2-D Math. 1-D 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.
Maple's commands are contained in the Maple library. There are two types of commands: top-level commands and package commands.
The top-level commands include many of the 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.
To use a top-level command, enter its name followed by parentheses (( )) containing any parameters. This is referred to as a calling sequence for the command.
Note: In 1-D 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.
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.
For detailed information on the properties of a function, use the FunctionAdvisor command.
Ia⁡z=za⁢F10⁡;a+1;z24Γ⁡a+1⁢2a,with no restrictions on ⁡a,z
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:
[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.
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).
Here are a few of the most frequently used Maple commands. A complete list of top-level commands is available on the index/function help page.
plot and plot3d
Create a two-dimensional and three-dimensional plot of functions.
Solve one or more equations or inequalities for their unknowns.
Solve one or more equations using floating-point arithmetic.
Evaluate an expression at a given point.
Numerically evaluate expressions.
Solve ordinary differential equations (ODEs).
Compute an indefinite or definite integral.
Compute an ordinary or partial derivative, as the context dictates.
Calculate the limiting value of a function.
For symbolic summation. It is used to compute a closed form for an indefinite or definite sum.
Set variable properties and relationships between variables. Similar functionality is provided by the assuming command.
Compute the value of an expression under assumptions.
Apply simplification rules to an expression.
Factor a polynomial.
Distribute products over sums.
Normalize a rational expression.
Convert an expression to a different type or form.
Type-checking 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.
Generalized series expansion.
Apply a procedure to each operand of an expression.
To use a package command, the calling sequence must include the package name, and the command name enclosed in square brackets ([ ]).
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.
For more information on optimization, see Optimization.
To unload a package:
Use the unwith command, specifying the package as an argument.
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 top-level command. For example, the plots package contains a changecoords command. Maple also contains a top-level changecoords command.
After the plots package is loaded, the name changecoords refers to the plots[changecoords] command. To use the top-level changecoords command, unload the package or use the restart command. (For alternative methods of accessing the top-level command, see the rebound help page.)
Here are a few of the most frequently used Maple packages. A complete list of packages is available on the index/package help page.
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®, JavaTM, Julia, Perl, and Python®.
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.
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.
The Physics package implements computational representations and related operations for most of the objects used in mathematical physics computations.
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.
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 units-matching for error checking of the solution.
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 first-order calculations of error analysis can be performed with these quantities.
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.
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
Calculus1 - single-variable calculus
LinearAlgebra - linear algebra
MultivariateCalculus - multivariate calculus
NumericalAnalysis - numerical analysis
Precalculus - precalculus
Statistics - statistics
VectorCalculus - multivariate vector calculus
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.
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.
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 2-D Math, clicking the definite integration item inserts:
Enter values in the placeholders. To move to the next placeholder, press Tab.
To evaluate the integral, press Enter.
In 1-D 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);
Note: Some palette items cannot be inserted into 1-D Math because they are not defined in the Maple language. When the cursor is in 1-D 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 2-D Math, including output.
To use the context panel:
Click the expression.
Move your mouse cursor over Pin Open Context Panel (
), or click it to fix the context panel in place.
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 floating-point number 0.3463678⁢+⁢1.7643.
Result in Document
Enter and execute the expression.
Click the output floating-point number.
From the context panel, select Conversions → Rational. The inserted calling sequence includes an equation label reference to the number you are converting.
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 point-and-click 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:
Open the Tools menu.
Select Assistants or Tutors.
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 by default executable. To enter nonexecutable mathematical content, use Shift + F5.
Insert any palette item. Palette items are inserted in Math mode (2-D 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.
Instead of re-entering 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 top-level 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.
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.
The assignment operator (:=) associates an expression with a name.
Recall that you can enter π using the following two methods.
Use the Common Symbols palette.
In 2-D Math enter pi, and then press the symbol completion shortcut key. See Shortcuts for Entering Mathematical Expressions.
When Maple evaluates an expression that contains a name, it replaces the name with its value. For example:
For information on Maple evaluation rules, see Evaluating Expressions.
To define a function, assign it to a name.
For example, define a function that computes the cube of its argument.
For information on creating functions, see Example 2 - Define a Mathematical Function.
Note: To insert the right arrow, enter the characters ->. In 2-D Math, Maple replaces -> with the right arrow symbol→. In 1-D Math, the characters are not replaced.
For example, define a function that squares its argument.
square := x -> x^2:
For more information on functions, see Functional Operators.
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. Try declaring `local sin`; see ?protect for details.
For more information, refer to the type/protected and protect help pages.
The unassign command resets the value of a name to itself. Note: You must enclose the name in right single quotes (' ').
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.
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:
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.
Using equation labels, you can refer to the result in other computations.
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.
Instead of re-entering 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:
From the Insert menu, select Label. Alternatively, double-click on the equation label (to the far right side of the output) or press Ctrl+L; Command+L, Macintosh.
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):
In the Expression palette, click the indefinite integration item
. The item is inserted and the integrand placeholder is highlighted.
Press Ctrl+L (Command+L, for Macintosh).
In the Insert Label dialog, enter 3.4. Click OK.
In the Insert Label dialog, enter 3.5. Click OK.
To move to the variable of integration placeholder, press Tab.
An equation label is associated with the last output within an execution group.
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
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 re-numbers 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.
Download Help Document
What kind of issue would you like to report? (Optional)