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 pointandclick interfaces or easytomodify 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


Section

Topics

Introduction

•

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






2.2 Introduction


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 $\mathrm{ln}\left({x}^{2}\+1\right)$ at $x\=4$.
$ln\left({x}^{2}+1\right)$$\stackrel{\text{differentiate w.r.t. x}}{\to}$$\frac{{2}{}{x}}{{{x}}^{{2}}{\+}{1}}$$\stackrel{\text{evaluate at point}}{\to}$$\frac{{8}}{{17}}$
Integrate $\mathrm{sin}\left(\frac{1}{x}\right)$ over the interval $\left[0\,\pi \right]$.
${\int}_{0}^{\pi}sin\left(\frac{1}{x}\right)\phantom{\rule[0.0ex]{0.5em}{0.0ex}}\ⅆx$ = ${\mathrm{sin}}{}\left(\frac{{1}}{{\mathrm{\π}}}\right){}{\mathrm{\π}}{}{\mathrm{Ci}}{}\left(\frac{{1}}{{\mathrm{\π}}}\right)$
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 2D Math (see Entering Expressions). It is also easy to enter mathematical expressions, such as:
•

Piecewisecontinuous functions: $\leftx\right=\left\{\begin{array}{cc}x& x<0\\ 0& x=0\\ x& 0<x\end{array}\right.$

•

Limits: $\delta \left(x\right)\=\underset{\epsilon \to 0}{lim}\epsilon {\leftx\right}^{\epsilon 1}$

•

Continued fractions: $\sqrt{2}\=1+\frac{1}{2+\frac{1}{2+\frac{1}{2+\cdots}}}$

and more complex expressions.
Mathematical expressions can contain the following objects.
•

Numbers: integers, rational numbers, complex numbers, floatingpoint values, finite field elements, $\mathrm{i}$, $\infty$, ...

•

Operators: $+\,$$\,$$\!\,$/, $\cdot \,$$\int \,$$\underset{x\to a}{lim}\,$$\frac{\partial}{\partial x\phantom{\rule[0.0ex]{0.2em}{0.0ex}}}comma;$...

•

Constants: $\mathrm{\π}\,ExponentialE;comma;$...

•

Mathematical functions: $\mathrm{sin}\left(x\right)\,$$\mathrm{cos}\left(\frac{\mathrm{\π}}{3}\right)\,$$\Gamma \left(2\right)\,$...

•

Names (variables): $x\,ycomma;zcomma;\mathrm{alpha;}comma;\mathrm{beta;}comma;$...

•

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 $\frac{\partial}{\partial t}{\ⅇ}^{{t}^{2}}$ using palettes.
Action

Result in Document

1.

In the Calculus palette, click the partial differentiation item
. Maple inserts the partial derivative. The variable placeholder is selected.



2.

Enter t, and then press Tab. The expression placeholder is selected.



3.

Enter ${\ⅇ}^{{t}^{2}}$. Note: To enter the exponential e, use the expression palette or command completion.


$\frac{\partial}{\partial t}\phantom{\rule[0.0ex]{0.4em}{0.0ex}}{ExponentialE;}^{{t}^{2}}$



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

Result in Document



2.

Select the partial differentiation item,



3.

Replace the placeholder with t. Use the right arrow to move out of the denominator. Enter ${\ⅇ}^{{t}^{2}}$ as in the previous example.


$\frac{\partial}{\partial t}{\ⅇ}^{{t}^{2}}$





Example 2  Define a Mathematical Function


Define the function $\mathrm{twice}\,$which doubles its input.
Action

Result in Document

1.

In the Expression palette, click the single variable function definition item,
.



2.

Replace the placeholder f with the function name, $\mathrm{twice}\.$ Press Tab to move to the next placeholder.



3.

Replace the parameter placeholder, a, with the independent variable $x\.$ Press Tab.



4.

Replace the output placeholder, y, with the desired output, $2xperiod;$


$\mathrm{twice}\u2254x\to 2x$
${\mathrm{twice}}{\u2254}{x}{\mapsto}{2}{}{x}$



$\mathrm{twice}\left(1342\right)$ = ${2684}$${}$
$\mathrm{twice}\left(yz\right)$ = ${2}{}{y}{}{2}{}{z}$${}$
Note: To insert the right arrow symbol $\to$, you can also enter the characters > in Math mode. In this case, symbol completion is automatic.
Important: The expression $2x$ is different from the function $x\to 2x$.
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.
$\frac{2}{9}+\frac{7}{11}$ = $\frac{{85}}{{99}}$
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.
$\frac{2}{9}+\frac{7}{11}$
$\frac{{85}}{{99}}$
 (2.1) 
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.
In text, pressing Enter inserts a line break.
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.
${\left(2{x}^{2}x+1\right)}^{}\left({x}^{2}+2x+12\right)$ = ${{x}}^{{2}}{}{3}{}{x}{}{11}$
$3\cdot \[\begin{array}{ccc}\mathrm{4}& 8& 99\\ 27& 69& 29\end{array}\]$ = $\left[\begin{array}{rrr}{}{12}& {24}& {297}\\ {81}& {207}& {87}\end{array}\right]$


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

Press Ctrl + = (Command + =, for Macintosh) or Enter.

The result is updated.
To update a group of computations:
2.

Select all edited expressions and the results to recalculate.

3.

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 syntaxfree computation are:
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.

Computing with Palettes


As discussed in Entering Expressions, some palettes contain mathematical operations.
To perform a computation using a palette mathematical operation:
1.

In a palette that contains operators, such as the Expression or Calculus palettes, click an operator item.

2.

In the inserted item, specify values in the placeholders.

3.

To execute the operation and display the result, press Ctrl+= (Command+=, for Macintosh) or Enter.

For example, to evaluate $\frac{\partial}{\partial t}{\ⅇ}^{{t}^{2}}$ inline:
2.

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

$\frac{\partial}{\partial t}{\ⅇ}^{{t}^{2}}$ = ${}{2}{}{t}{}{{\ⅇ}}^{{}{{t}}^{{2}}}$


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

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: $\frac{2}{3}$$\stackrel{\text{at 10 digits}}{\to}$${0.6666666667}$
You can perform a sequence of operations by repeatedly using context panel options. For example, to compute the derivative of $\mathrm{cos}\left({x}^{2}\right)\,$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:
$\mathrm{cos}\left({x}^{2}\right)$$\stackrel{\text{differentiate w.r.t. x}}{\to}$${}{2}{}{\mathrm{sin}}{}\left({{x}}^{{2}}\right){}{x}$$\stackrel{\text{evaluate at point}}{\to}$${}{20}{}{\mathrm{sin}}{}\left({100}\right)$
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.
For example:
Enter the expression ${x}^{2}$.

${x}^{2}$

Click on the expression and use the Differentiate option from the context panel to differentiate with respect to x.

${x}^{2}$$\stackrel{\text{differentiate w.r.t. x}}{\to}$${2}{}{x}$

Click on 2x and use the Integrate option from the context panel to integrate with respect to x.

${x}^{2}$$\stackrel{\text{differentiate w.r.t. x}}{\to}$${2}{}{x}$$\stackrel{\text{integrate w.r.t. x}}{\to}$${{x}}^{{2}}$

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.

${x}^{2}$$\stackrel{\text{differentiate w.r.t. x}}{\to}$${2}{}{x}$$\stackrel{\text{differentiate w.r.t. x}}{\to}$${2}$
${}$



The following subsections provide detailed instructions on performing a few of the numerous operations available using contextsensitive operations in the context panel.

Approximating the Value of an Expression


To approximate a fraction numerically:
2.

Click the fraction to display the context panel. See Figure 2.2.

3.

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



$\frac{2}{3}$$\stackrel{\text{at 10 digits}}{\to}$${0.6666666667}$
You can replace the inserted right arrow with text or mathematical content.
To replace the right arrow ($\to$):
1.

Select the arrow and text. Press Delete.

2.

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 ≈.
$\frac{2}{3}$$\stackrel{\mathrm{is}\mathrm{approximately}\mathrm{equal}to}{\to}$${0.6666666667}$${}$
$\frac{2}{3}$$\approx$${0.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:
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



$\frac{7{x}^{2}}{3}\frac{x}{\mathrm{\π}}\=12$$\stackrel{\text{solve}}{\to}$$\left\{{x}{\=}\frac{{3}}{{14}}{}\frac{{1}{\+}\sqrt{{112}{}{{\mathrm{\π}}}^{{2}}{\+}{1}}}{{\mathrm{\π}}}\right\}{\,}\left\{{x}{\=}{}\frac{{3}}{{14}}{}\frac{{}{1}{\+}\sqrt{{112}{}{{\mathrm{\π}}}^{{2}}{\+}{1}}}{{\mathrm{\π}}}\right\}$
$\frac{7{x}^{2}}{3}\frac{x}{\mathrm{\π}}\=12$$\stackrel{\text{solve}}{\to}$${}{2.200603126}{\,}{2.337021648}$
For more information on solving equations, including solving inequations, differential equations, and other types of equations, see Solving Equations.


Using Units


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

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

Enter the expression using the units palettes to insert units.

3.

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.
$\frac{590\u27e6C\u27e7}{2.9\u27e6s\u27e7}$$\stackrel{\text{simplify units}}{\to}$${203.4482759}{}\u27e6{A}\u27e7$
For more information on using units, see Units.



Assistants and Tutors


Assistants and tutors provide pointandclick interfaces with buttons, text input regions, and sliders. For details on assistants and tutors, see PointandClick 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:${}$
Action

Result in Document

1.

In a new document block, create the matrix or set of linear equations to be solved.


$\left[\begin{array}{ccccc}1& 3& 0& 2& 1\\ 4& 2& 1& 5& 7\\ 0& 3& 5& 4& 7\\ 1& 1& 3& 6& 5\end{array}\right]$

2.

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.


Loading Student:LinearAlgebra

3.

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 rowechelon form, then performs backsubstitution to solve the system. Gauss Jordan Elimination reduces the matrix to reduced rowechelon form, where the equations are already solved. For this example, choose Gaussian Elimination.



4.

The Gaussian Elimination dialog opens. You can specify the Gaussian elimination stepbystep, or you can use the Next Step or All Steps buttons to have Maple perform the steps for you.

5.

Once the matrix is in rowechelon (uppertriangular) form, click the Solve System button to move to the next step.



6.

The Solve the system of equations in RowEchelon 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.



7.

Click the Close button to return the solution to your document.


$\left[\begin{array}{ccccc}1& 3& 0& 2& 1\\ 4& 2& 1& 5& 7\\ 0& 3& 5& 4& 7\\ 1& 1& 3& 6& 5\end{array}\right]$$\stackrel{\text{linear solve tutor}}{\to}$$\left[\begin{array}{r}{}{4}\\ {3}\\ {}{2}\\ {3}\end{array}\right]$



For more information on linear systems and matrices, see Linear Algebra.




Contents Previous Next Index
${}$
