Contents Previous Next Index
2 Document Mode
Using the Maple software, you can create powerful interactive documents. You can visualize and animate problems in two and three dimensions. You can solve complex problems with simple point-and-click interfaces or easy-to-modify interactive documents. You can also devise custom solutions using the Maple programming language. While you work, you can document your process, providing text descriptions.
2.1 In This Chapter
Comparison of Document and Worksheet Modes
Entering Expressions - Overview of tools for creating complex mathematical expressions
Evaluating Expressions - How to evaluate expressions
Displaying the Value Inline
Displaying the Value on the Following Line
Editing Expressions and Updating Output - How to update expressions and regenerate results
Updating a Single Computation
Updating a Group of Computations
Updating All Computations in a Document
Performing Computations- Overview of tools for performing computations and solving problems
Computing with Palettes
Assistants and Tutors
Maple has two modes: Document mode and Worksheet mode.
Document mode is designed for quickly performing calculations. You can enter a mathematical expression, and then evaluate, manipulate, solve, or plot it with a few keystrokes or mouse clicks. This chapter provides an overview of Document mode.
Document mode sample:
Find the value of the derivative of lnx2+1 at x⁢=⁢4.
ln⁡x2⁢+⁢1→differentiate w.r.t. x2⁢xx2+1→evaluate at point817
Integrate sin1x over the interval 0,⁢π.
∫0π⁡sin⁡1xⅆx = sin⁡1π⁢π−Ci⁡1π
Worksheet mode is designed for interactive use through commands and programming using the Maple language. The Worksheet mode supports the features available in Document mode described in this chapter. For information on using Worksheet mode, see Chapter 3, Worksheet Mode. Note: To enter a Maple input prompt while in Document mode, click
in the Maple toolbar.
Important: In any Maple document, you can use Document mode and Worksheet mode.
Interactive document features include:
Embedded graphical interface components, like buttons, sliders, and check boxes
Automatic execution of marked regions when a file is opened
Character and paragraph formatting styles
These features are described in Chapter 7, Creating Mathematical Documents.
Note: This chapter and Chapter 1 were created using Document mode. All of the other chapters were created using Worksheet mode.
2.3 Entering Expressions
Chapter 1 provided an introduction to entering simple expressions in 2-D Math (see Entering Expressions). It is also easy to enter mathematical expressions, such as:
Piecewise-continuous functions: x=−xx<00x=0x0<x
Continued fractions: 2⁢=⁢1⁢+⁢12⁢+⁢12⁢+⁢12⁢+⁢⋯
and more complex expressions.
Mathematical expressions can contain the following objects.
Numbers: integers, rational numbers, complex numbers, floating-point values, finite field elements, ⅈ, ∞, ...
Operators: +,−,!,/, ⋅,∫,limx→a,∂∂x ,...
Constants: π, ⅇ,...
Mathematical functions: sinx,cosπ3,Γ2,...
Names (variables): x, y, z, α, β,...
Data structures: sets, lists, Arrays, Vectors, Matrices, ...
Maple contains over a thousand symbols. For some numbers, operators, and names, you can press the corresponding key, for example, 9, =, >, or x. Most symbols are not available on the keyboard, but you can insert them easily using two methods, palettes and symbol names.
Example 1 - Enter a Partial Derivative
To insert a symbol, you can use palettes or symbol names.
Enter the partial derivative ∂∂tⅇ−t2 using palettes.
Result in Document
In the Calculus palette, click the partial differentiation item
. Maple inserts the partial derivative. The variable placeholder is selected.
Enter t, and then press Tab. The expression placeholder is selected.
Enter ⅇ−t2. Note: To enter the exponential e, use the Expression palette or the Common Symbols palette. Here, we use the
template from the Expression palette.
Click the template. The exponent placeholder is selected. Enter the exponent.
To evaluate the derivative and display the result inline, press Ctrl+= (Command+=, for Macintosh) or Enter. For more information, see Computing with Palettes.
You can enter any expression using symbol names and the symbol completion list.
Begin typing the name of the symbol, diff, and press the symbol completion key (see Shortcut Keys by Platform).
Select the partial differentiation item,
Replace the placeholder with t. Use the right arrow to move out of the denominator. Enter ⅇ−t2 as in the previous example.
Example 2 - Define a Mathematical Function
Define the function twice,which doubles its input.
In the Expression palette, click the single variable function definition item,
Replace the placeholder f with the function name, twice. Press Tab to move to the next placeholder.
Replace the parameter placeholder, a, with the independent variable x. Press Tab.
Replace the output placeholder, y, with the desired output, 2 x.
twice1342 = 2684
twicey−z = 2⁢y−2⁢z
Note: To insert the right arrow symbol →, you can also enter the characters -> in Math mode. In this case, symbol completion is automatic.
Important: The expression 2⁢x is different from the function x⁢→⁢2 x.
For more information on functions, see Functional Operators.
2.4 Evaluating Expressions
To evaluate a mathematical expression, place the cursor in the expression and press Ctrl + = (Command + =, for Macintosh). That is, press and hold the Ctrl (or Command) key, and then press the equal sign (=) key.
To the right of the expression, Maple inserts an equal sign and then the value of the expression.
29+711 = 8599
In mathematical content, pressing Enter evaluates the expression and displays it centered on the following line. The cursor moves to a new line below the output.
By default, Maple labels output that is generated by pressing Enter. For information on equation labels, see Equation Labels. In this manual, labels are generally not displayed.
You can use the basic algebraic operators, such as + and −, with most expressions, including polynomials—see Polynomial Algebra and matrices and vectors—see Matrix Arithmetic.
2⁢x2−x+1−x2+2⁢x+12 = x2−3⁢x−11
Tip: The Enter key has a number of uses.
Pressing Enter with your cursor in a math expression executes it and evaluates it on a new line.
Pressing Enter in text inserts a line break.
Pressing Enter when at the beginning of a line (the Home position) inserts a new line above the current line.
For more information on these concepts, refer to the Using Document Blocks help page.
Tip: If you want to change an input/output expression from evaluate and display inline to evaluate and display on a new line, with your cursor in the input expression, from the Evaluate menu or the Context Panel, clear the check box beside Evaluate and Display Inline.
2.5 Editing Expressions and Updating Output
One important feature of Maple is that your documents are live. That is, you can edit expressions and quickly recalculate results.
To update one computation:
Edit the expression.
Press Ctrl + = (Command + =, for Macintosh) or Enter.
The result is updated.
To update a group of computations:
Edit the expressions.
Select all edited expressions and the results to recalculate.
Click the Execute toolbar icon
All selected results are updated.
To update all output in a Maple document:
Click the Execute All toolbar icon
All results in the document are updated.
Note: Be careful when you revisit a document and make changes, as it's possible to produce a document with worksheet commands out of order (i.e. where a certain command won't work properly without a later one).
2.6 Performing Computations
Using the Document mode, you can access the power of the advanced Maple mathematical engine without learning Maple syntax. In addition to solving problems, you can also easily plot expressions.
The primary tools for syntax-free computation are:
The Context Panel
Assistants and tutors
Note: The Document mode is designed for quick calculations, but it also supports Maple commands. For information on commands, see Commands in Chapter 3, Worksheet Mode.
Important: In Document mode, you can execute a statement only if you enter it in Math mode. To use a Maple command, you must enter it in Math mode.
As discussed in Entering Expressions, some palettes contain mathematical operations.
To perform a computation using a palette mathematical operation:
In a palette that contains operators, such as the Expression or Calculus palettes, click an operator item.
In the inserted item, specify values in the placeholders.
To execute the operation and display the result, press Ctrl+= (Command+=, for Macintosh) or Enter.
For example, to evaluate ∂∂tⅇ−t2 inline:
Using the Calculus palette, enter the partial derivative. See Example 1 - Enter a Partial Derivative.
Press Ctrl+= (Command+=, for Macintosh).
∂∂tⅇ−t2 = −2⁢t⁢ⅇ−t2
Computing with 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 2.1.
Figure 2.1: Context Panel
To display 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.
The context panel is displayed.
You can evaluate expressions using context panel options. The Evaluate and Display Inline operation (see Figure 2.1) is equivalent to pressing Ctrl+= (Command+=, for Macintosh). That is, it inserts an equal sign (=) and then the value of the expression.
Alternatively, press Enter to evaluate the expression and display the result centered on the following line.
For more information on evaluation, see Evaluating Expressions.
From the context panel, you can also select operations different from evaluation. To the right of the expression, Maple inserts a right arrow symbol (→) and then the result.
For example, use the Approximate operation to approximate a fraction: 23→at 10 digits0.6666666667
You can perform a sequence of operations by repeatedly using context panel options. For example, to compute the derivative of cosx2,use the Differentiate operation on the expression, and then to evaluate the result at a point, use the Evaluate at a Point operation on the output and enter 10:
cosx2→differentiate w.r.t. x−2⁢sin⁡x2⁢x→evaluate at point−20⁢sin⁡100
Note: For the sequence of operations to make sense when being read from left to right, stale results are deleted before new operations are performed.
Enter the expression x2.
Click on the expression and use the Differentiate option from the context panel to differentiate with respect to x.
x2→differentiate w.r.t. x2⁢x
Click on 2x and use the Integrate option from the context panel to integrate with respect to x.
x2→differentiate w.r.t. x2⁢x→integrate w.r.t. xx2
Click on 2x again and use the Differentiate option to differentiate with respect to x.
Notice how the result of integration with respect to x has been replaced with the result of differentiation with respect to x so that the sequence of operations makes sense.
x2→differentiate w.r.t. x2⁢x→differentiate w.r.t. x2
The following subsections provide detailed instructions on performing a few of the numerous operations available using context-sensitive operations in the context panel.
Approximating the Value of an Expression
To approximate a fraction numerically:
Enter a fraction.
Click the fraction to display the context panel. See Figure 2.2.
From the context panel, select Approximate, and then the number of significant digits to use: 5, 10, 20, 50, or 100.
Figure 2.2: Approximating the Value of a Fraction
23→at 10 digits0.6666666667
You can replace the inserted right arrow with text or mathematical content.
To replace the right arrow (→):
Select the arrow and text. Press Delete.
Enter the replacement text or mathematical content.
Note: To replace the right arrow with text, you must first press F5 to switch to Text mode.
For example, you can replace the arrow with the text "is approximately equal to" or the symbol ≈.
23→is approximately equal to0.6666666667
Solving an Equation
You can find an exact (symbolic) solution or an approximate (numeric) solution of an equation. For more information on symbolic and numeric computations, see Symbolic and Numeric Computation.
To solve an equation:
Enter an equation.
Display the context panel. See Figure 2.3.
From the context panel, select Solve or Numerically Solve in the Solve menu item.
Figure 2.3: Finding the Approximate Solution to an Equation
For more information on solving equations, including solving inequations, differential equations, and other types of equations, see Solving Equations.
You can create expressions with units. To specify a unit for an expression, use the Units palette. See Figure 2.4.
Figure 2.4: Units Palette
To insert an expression with a unit:
Enter the expression.
In a unit palette, click a unit symbol.
Note: To include a reciprocal unit, divide by the unit.
To evaluate an expression that contains units:
Enter the expression using the units palettes to insert units.
From the context panel, select the Simplify menu and then Simplify.
For example, compute the electric current passing through a wire that conducts 590 coulombs in 2.9 seconds.
For more information on using units, see Units.
Assistants and tutors provide point-and-click interfaces with buttons, text input regions, and sliders. For details on assistants and tutors, see Point-and-Click Interaction.
Assistants and tutors can be launched from the Tools menu or the Context Panel for an expression. For example, you can use the Linear System Solving tutor to solve a linear system, specified by a matrix or a set of equations.
Example 3 - Using the Context Panel to Open the Linear System Solving Tutor
Use the Linear System Solving tutor to solve the following system of linear equations, written in matrix form:
In a new document block, create the matrix or set of linear equations to be solved.
Load the Student[LinearAlgebra] package. From the Tools menu, select Load Package → Student Linear Algebra. This makes the tutors in that package available. For details, see Package Commands.
Click the matrix and from the context panel select Student Linear Algebra → Tutors → Linear System Solving.... The Linear System Solving dialog appears, where you can choose the solving method. Gaussian Elimination reduces the matrix to row-echelon form, then performs back-substitution to solve the system. Gauss Jordan Elimination reduces the matrix to reduced row-echelon form, where the equations are already solved. For this example, choose Gaussian Elimination.
The Gaussian Elimination dialog opens. You can specify the Gaussian elimination step-by-step, or you can use the Next Step or All Steps buttons to have Maple perform the steps for you.
Once the matrix is in row-echelon (upper-triangular) form, click the Solve System button to move to the next step.
The Solve the system of equations in Row-Echelon Form dialog appears. Click the buttons on the right to calculate the solution: first find the Equations, then solve for each variable. Click the Solution button to display the solution in the tutor.
Click the Close button to return the solution to your document.
130−2−142−1570−354−71−1365→linear solve tutor
For more information on linear systems and matrices, see Linear Algebra.
Download Help Document