Entering 2-D Math
2-D math entry allows you to enter mathematical expressions in standard form as found in papers and books.
This document discusses general entry and entry for specific classes of expressions using 2-D math.
To interact with the examples on this page, open it as worksheet and execute the steps.
Note for non-Windows users: The keystrokes given in this document are for Windows. There will be differences for other platforms. For instance, for Mac users, replace Ctrl with Command to follow the examples. For more keyboard shortcuts for your platform, see Shortcut Keys.
|
Standard Entry
|
|
Much of the standard entry is covered on the 2-D Math Shortcut Keys help page, including how to navigate 2-D expressions and how to escape characters that are shortcut keys.
For more introductory information, see the basic Overview of 2-D Math and the material found under Getting Started in the Maple Help System.
This page covers some further details and demonstrates a few nuances using some helpful examples.
|
|
Executable and Nonexecutable Math
|
|
2-D math expressions are by default executable.
To evaluate an expression and display the result on a new line, press:
•
|
Enter, Windows and Linux
|
To evaluate an expression and display the result inline, press:
•
|
Alt + Enter, or Ctrl + =, Windows and Linux
|
•
|
Alt + Return, or Command + =, Mac
|
You can toggle a 2-D math expression to nonexecutable math. Use nonexecutable math for expressions that are intended only for display.
When you are editing a 2-D math expression, the background color indicates if the math is executable (blue background) or nonexecutable (gray background).
Executable Math
|
Nonexecutable Math
|
|
|
|
|
To toggle between executable and nonexecutable math, click an expression and use the shortcut key Shift + F5. Alternatively, under the Edit menu, clear the check box beside Executable Math.
Tip: If an expression is executed accidentally, it can lead to error messages (if it is not valid Maple syntax) or unwanted output. If this happens, toggling the expression to nonexecutable math removes the error message or output and changes the math to nonexecutable.
Top of the Page
|
|
Multiplication
|
|
In general, you can use * or a space to imply multiplication. In 2-D math, * appears as a center dot ().
>
|
|
2-D math input allows for some implicit multiplication, that is, writing a multiplication operation without requiring a multiplication sign. For example, a space is used between x and x to mean multiplication:
=
Tip: Troubleshooting your mathematics is easier if you use explicit multiplication symbols.
Exceptions to this rule include cases where it is clear that only multiplication can be implied. Then a space is not necessary:
Note: For a product containing integers and decimals, implicit multiplication can be used only if the number occurs in the left-most position in the product. For products of numbers, use explicit multiplication (*). However, you can use implicit multiplication for products containing fractions.
Valid
|
=
|
Not valid
|
|
Valid
|
=
=
|
Valid
|
=
|
|
|
To avoid common errors in entering expressions in 2-D math, Maple automatically inserts an explicit multiplication symbol in certain cases. You can control this feature. For details, see the Convert Space to Explicit Multiplication Operator section of the Options Dialog.
Using space to imply multiplication
|
Expression and result
|
Space between x and x
|
=
|
Space between x and (x+1)
Space between f and (x+1)
When you type a space between x and (x+1), Maple automatically inserts an explicit multiplication symbol to indicate multiplication.
|
=
=
|
No space between f and x
The expression parses differently than
=
because without the space it means function application.
|
=
|
Caution: Do not put a space between a function name and its arguments. This will be interpreted as multiplication.
This results in the incorrect result see here, because a space between cos and (a) is multiplication!
With no space, this is the cos function applied to a, and the result is 1, as expected.
|
=
=
|
|
|
In addition, by default, expressions like and parse to products instead of operators (the latter being the default in 1-D math).
This behavior can be changed using the Typesetting Rule Assistant, or by adjusting Typesetting settings as follows:
>
|
|
>
|
|
Top of the Page
|
|
2-D Operators
|
|
The 2-D math mode allows direct entry of 2-D mathematical objects, such as integrals, sums, products, and limits.
Command-Symbol Completion Keys
|
Esc, Mac, Windows, and Linux
|
|
Ctrl + Shift + Space, Linux
|
|
|
|
These are also available on the Expression and Calculus palettes.
Examples
|
Steps
|
Definite sum:
=
|
1.
|
Type and use command completion to select
|
2.
|
Press Ctrl + ' and type
|
3.
|
Use Right Arrow key to exit subscript
|
4.
|
Press Ctrl + Shift + " and type
|
5.
|
Use Right Arrow key to exit superscript
|
Alternatively:
1.
|
Type and use command completion to select
|
2.
|
Press Tab to move between placeholders and replace:
|
|
Directional limit:
=
|
1.
|
Type or , press Ctrl + ' , type ->
|
Alternatively:
1.
|
Type and use command completion to select
|
2.
|
Press Tab to move between placeholders and replace:
|
|
Directional limit:
=
|
1.
|
Type or , press Ctrl + ' , type ->
|
|
Integrals require a special character for the 'd' prefix of the integration variable (DifferentialD):
=
|
1.
|
Type and use command completion to select
|
2.
|
Press Ctrl + Shift + _ and type .
|
4.
|
Press Shift + ^ and type
|
6.
|
Type and use command completion to select the Differential'd'
|
|
The integration limits can also be entered over and under the integral sign:
=
|
1.
|
Type and use command completion to select
|
2.
|
Press Ctrl + ' and type
|
4.
|
Press Ctrl + Shift + " and type
|
6.
|
Type and use command completion to select the Differential'd'
|
|
In addition, many formatted 2-D notations are directly available in the command-symbol completion mechanism. This alternative entry technique is demonstrated here:
=
|
1.
|
Type and use command completion to select
|
2.
|
Press Tab to move between placeholders and replace:
|
|
|
|
Inert Functions
Inert functions are used to delay evaluation. That is, during computations, the operation they represent remains unperformed.
Inert versions of the int, sum, and limit functions are denoted by the symbols appearing gray in color, the inert version of eval has the evaluation bar in gray, and the inert diff function has the differentiation symbols in gray.
You can enter these functions in 2-D math in two ways:
Example: =
|
Steps
|
Using command-symbol completion:
The inert functions can be entered with command-symbol completion using the inert versions of the function names, such as Int and Sum.
|
1.
|
Type and use command completion to select
|
2.
|
Press Tab to replace the placeholders and with
|
|
Using palettes:
The active (noninert) functions can be entered from the palettes. You can then convert the expression to its inert form.
|
1.
|
From the Expression or Calculus palette, select the template .
|
2.
|
Press Tab to replace the placeholders and with
|
3.
|
From the Context Panel for the expression, select 2-D Math > Convert To > Inert Form. (The and turns gray in color.)
|
|
|
|
Top of the page
|
|
Separators while Programming in 2-D Math
|
|
In general, 2-D math statements do not need to be terminated with a semicolon. However, a statement separator (semicolon or colon) is necessary between two statements in one input region. Otherwise, there will be ambiguity when Maple parses multiple statements.
In the following example, an error occurs because a separator has been omitted between the two statements entered between the use and end use keywords.
This issue can be resolved by adding a semicolon after the first statement.
To suppress the output, use a colon after the end use statement:
|
|
Derivative Notation and Implied Dependency
|
|
Many standard derivative notations are supported for 2-D math entry methods, including prime notation, dot notation, Leibniz notation, and repeated index notation, but there are a number of settings that you must be aware of when using these. Display in output can be controlled as well.
|
Prime Notation
|
|
Prime notation, by default, uses the variable . When entering a derivative in prime notation, if no dependency is present, then the function is assumed to be a function of . For example:
| (6.1.1) |
>
|
|
| (6.1.2) |
If an explicit dependency is present, the function is assumed to be the derivative of a function of evaluated at that value. If the dependent variable is not assigned, or is a known function (like sin), then D notation is used:
|
To enter the prime notation:
1.
|
Type the expression in math mode, or
|
2.
|
From the Calculus palette, select the appropriate template. To fill in the content, navigate through the placeholders using the Tab key.
|
|
|
|
If the dependent variable is assigned, and is not a known function, then eval/diff notation is used:
>
|
|
| (6.1.4) |
|
To enter the prime notation:
3.
|
Type the expression in math mode, or
|
4.
|
From the Calculus palette, select the appropriate template. To fill in the content, navigate through the placeholders using the Tab key.
|
|
|
|
The variable becomes more important when prime is applied to an expression, as follows:
|
|
Dot Notation
|
|
Dot notation, by default, uses the variable , so names with a dot and no dependencies explicitly listed are assumed to depend on :
| (6.2.1) |
>
|
|
| (6.2.2) |
The dot notation can be entered in one of the following ways:
Using keyboard shortcuts
|
Using palette templates
|
2.
|
Press Ctrl + Shift + "
|
4.
|
Use the Right Arrow key to leave the superscript position
|
|
1.
|
Select from the Calculus palette
|
|
|
|
Just as for primes, the use of dot with an explicit dependency different from the dot variable is assumed to be the derivative of a function of evaluated at that value:
To enter the dot notation:
4.
|
Press Ctrl + Shift + "
|
6.
|
Use the Right Arrow key to leave the superscript position
|
|
|
Prime or Dot Notation in Output Display
|
|
The output display can be modified to use prime and/or dot notation in the interactive Typesetting Rule Assistant, or by using the Typesetting package Settings command.
For example, use dot notation in typeset derivatives in place of notation:
>
|
|
>
|
|
|
|
Leibniz Notation
|
|
Leibniz notation can be used to specify derivatives and partial derivatives. Short-form use for partial derivatives requires that the function dependencies be suppressed. Function dependency suppression can be enabled in the interactive Typesetting Rule Assistant, or by using the Typesetting package Suppress command.
Univariate examples:
>
|
|
>
|
|
To enter the Leibniz notation for univariate differentiation, select and , respectively, from the Calculus palette and press Tab to fill in the contents.
Multivariate examples:
>
|
|
To enter the Leibniz notation for multivariate differentiation, select and , respectively, from the Calculus palette and press Tab to fill in the contents.
Short form of Leibniz notation:
You can use Typesetting:-Suppress to evaluate the derivative as follows:
>
|
|
This typeset enables short-form entry of function names as well:
To enable repeated index notation for partial derivatives, use the following command:
>
|
|
|
Top of the page
|
|
Vector Calculus
|
|
In addition to standard matrix and vector-style entry, 2-D math also supports vector and vector calculus operations in standard syntax through the VectorCalculus package.
Command-Symbol Completion Keys
|
Esc, Mac, Windows, and Linux
|
|
Ctrl + Shift + Space, Linux
|
|
|
|
|
Dot Product
|
|
Type <1,2>.<0,1>:
>
|
|
|
|
Cross Product
|
|
>
|
|
Type &x as cross-product operator:
>
|
|
Or, use × from the Common Symbols palette:
>
|
|
In the following example, note the change in display of output for after unloading the package.
>
|
|
>
|
|
|
|
Gradient
|
|
>
|
|
The coordinate system can be specified within individual calls:
>
|
|
Or, set coordinate system as follows:
>
|
|
Choose from one of the following input style:
>
|
|
>
|
|
From the Common Symbols palette, select ∇, or type and use command completion to select ∇.
Alternatively, type , select and enter the vector field.
Note: For computation using other coordinate systems, see VectorCalculus[Coordinates].
|
|
Divergence
|
|
>
|
|
>
|
|
Use one of the following methods:
>
|
|
>
|
|
The vector field can be assigned separately as well:
>
|
|
From the Common Symbols palette, select ∇ followed by · .
Alternatively, type or to enter the Del operator, or type , select and enter the vector field.
Note: For computation using other coordinate systems, see VectorCalculus/Coordinates.
|
|
Curl
|
|
>
|
|
>
|
|
Use one of the following methods:
>
|
|
>
|
|
>
|
|
Create the vector field separately:
>
|
|
From the Common Symbols palette, select ∇ followed by × . Or, type or to enter the Del operator, or type , select and enter the vector field.
Note: For computation using other coordinate systems, see VectorCalculus/Coordinates.
|
|
Laplacian
|
|
>
|
|
>
|
|
1.
|
Laplacian in Cartesian coordinates:
|
>
|
|
2.
|
Laplacian using polar coordinates:
|
>
|
|
3.
|
Laplacian using cylindrical coordinates:
|
>
|
|
4.
|
Use expressions of the form (Del . Del)(f), Del . (Del(f)), or Del . Del(f):
5.
|
Type or to enter the Del operator, or type , select and enter the vector field.
Alternatively, press Shift + ^ to enter 2 as exponent of Del. Use right arrow key to leave exponent.
|
6.
|
From the Expression palette, select . Use the Tab key to move between placeholders and replace with ∇ (available in the Common Symbols palette) and with .
|
|
Top of the page
|
|
Special Functions
|
|
For convenience and control you can customize 2-D math typesetting of special functions. There are three ways to input special functions: by calling sequence, by command completion, or by enabling parsing rules. You can control the output display of special functions as well.
|
Special Functions Entry in Input
|
|
You can enter special functions in Maple using their calling sequences, for example, BesselJ(v,x) is the Bessel function of the first kind.
You can also use the command completion mechanism to enter special functions in a typeset mathematical notation (textbook notation).
Command-Symbol Completion Keys
|
Esc, Mac, Windows, and Linux
|
|
Ctrl + Shift + Space, Linux
|
|
|
|
For example,type , use command completion to select , and press Tab to replace with and with .
Similarly, enter the BesselI function.
| (8.1.1) |
In addition, the completion of functions where the mathematical notation is based on an alphanumeric character is available by using command-symbol completion on that character. For example, to enter the BesselI function using command completion, type and select .
The final option is to enable parsing rules so you can enter, for example, J with a subscript and have it parsed as the BesselJ function. In most cases, the rules for 2-D math entry must be enabled using the Typesetting Rule Assistant or from the command line using the Typesetting[EnableParseRule] function.
Enable the parse rules for Bessel functions.
>
|
|
Now you can enter Bessel functions in standard notation.
Type input as shown:
|
|
Special Function Display in Output
|
|
You can change the display of special functions in the output using the Typesetting:-EnableTypesetRule command.
>
|
|
Note: Under standard typesetting mode, the option for typeset display of special functions has no effect:
>
|
|
| (8.2.2) |
>
|
|
You can also control the typeset display for individual special functions through the Typesetting Rule Assistant.
|
Top of the page
|
|
Generalized Operators and Equations
|
|
MathML operators available within Maple parse, by default, to binary operators using the same name as the normalized entity name.
Note: The precedence of these operators is the same as for '=' for any operators in the Arrows, Relational, Relational Round, and Negated palettes, and the same as neutral operators '&...' for all other operators.
Example
|
Steps
|
expr is actually stored as a function with function name `≪`. If you enter the following:
>
|
|
|
Enter the much less than operator from the Relational palette.
|
|
The operator can be entered in one of the following ways:
2.
|
Type and use the command completion method
|
3.
|
Select the operator from the Relational palette
|
|
Following is an example which demonstrates that any non-equivalence operators have higher precedence than multiplication:
Now, compare this result to the the following:
Here the multiplication operator has higher precedence.
|
For the first example:
4.
|
Select the template from the Expression palette
|
6.
|
To enter the boxtimes operator, type and use the command completion method.
|
8.
|
Press Tab to enter a*d as denominator
|
|
|
|
Top of the page
|
|
Tolerances/Optional Forms
|
|
The and operators have special precedence rules that enable them to be used in two forms.
The default is to treat them with the same precedence as addition, in which case they can be used to describe an expression with two optional values, one choosing the upper operator, and the other choosing the lower operator. In this case, these operators are internally represented as unary operators.
>
|
|
>
|
|
>
|
|
An optional equation using and/or :
>
|
|
At this point, the value of 'whichval' lets you change the value of the expression:
| (10.1) |
| (10.2) |
Alternatively, the symbol can be used as a binary operator to describe a tolerance from the Tolerances package.
The meaning of the symbol can be switched from use for optional values to tolerances in either the Typesetting Rule Assistant, by the command line Typesetting:-Settings command, or simply by loading the Tolerances package:
Top of the page
|
|
Logic
|
|
Available logical (boolean) operators in 2-D math include nand, nor, and iff, defined in terms of the existing logic operations not, and, or, xor, and implies. Each boolean operation has a symbolic counterpart.
Each logic operation, the MathML symbol used, and the symbolic form are demonstrated in the following table:
Operation
|
Standard Form
|
Symbol
|
Symbol Form
|
not
|
=
|
not
|
=
|
nand
|
=
|
uarr
|
=
|
and
|
=
|
and
|
=
|
nor
|
=
|
darr
|
=
|
or
|
=
|
or
|
=
|
xor
|
=
|
veebar
|
=
|
implies
|
=
|
Implies
|
=
|
iff
|
=
|
iff
|
=
|
|
|
As an additional convenience, the nand, nor, xor, and implies operations have completion shortcuts available for their corresponding symbols (as their MathML entity names are quite different).
For example:
•
|
Use command completion to enter
|
•
|
Type and press Enter to evaluate
|
When the Logic package is loaded, the logic expressions, in both symbolic and verbal form, parse to Logic package operations. Note: While the outputs display similarly, there are differences between the underlying implementation of the Logic package operators and the top-level logical operators. For more information, see the help pages boolean, Logic, and Logic Package Operators.
Note: When the Logic package is loaded, the standard logic operations are still available in prefix form.
Top of the page
|
|
Atomic Variables (Literal Names)
|
|
Maple can work with composite or colored objects that are to be considered distinct from the components making up the objects or the object without the same color attributes. These objects are called atomic objects.
If you want to display a single Maple expression as an atomic object, select the expression, and then in the Format>Convert to menu, select the Atomic Variable check box. This can also be accessed through the Context Panel for the expression: 2-D math>Convert To>Atomic Variable. Alternatively, press Ctrl + Shift + A (Windows and Linux) or Command + Shift + A (Mac).
In simple cases where a script object is composed with a base and one or more scripts of a simple type (identifier, operator, or number), which otherwise has no meaning in Maple, these objects become atomic automatically.
Example
|
Steps
|
|
1.
|
Press Ctrl + Shift + " to enter the overscript for
|
2.
|
Use one of the following methods to enter tilde:
|
•
|
Select ~ from the Common Symbols palette
|
•
|
Type and use command completion method
|
3.
|
Use Right Arrow key to leave overscript
|
|
|
|
This name assigned to is different from , and in fact has no relation to , as it is .
Assigning the value of does not affect this name.
Furthermore, is treated as any other name in Maple.
| (12.2) |
For this reason, in some cases where a parse error would result, the expression is instead assumed to be of atomic type, and is treated as such. For example, the following three values would result in parse errors, but since they are simple objects, are instead identified as atomic objects.
Example
|
Steps
|
>
|
|
| (12.3) |
|
To enter the superscript for press Shift + ^ . Use Right Arrow key to leave superscript.
|
|
|
The internal representations of these atomic variables are composed of MathML construct, which can be displayed in the following manner:
| (12.4) |
If this automatic behavior is not desired, it can be disabled through the Typesetting Settings command or through the Typesetting Rule Assistant:
>
|
|
Expressions that would normally parse as Maple objects can be converted to atomic objects using the context menu. For example, with a subscript of is normally interpreted as a table reference:
Note that this returns '1' subscripted by '1' because was assigned to 1 earlier.
To work with this notation as a name, different from , enter the expression, select it, then from the Context Panel select 2-D math>Convert To>Atomic Variable and evaluate.
Alternately, in this specific case, you can use two underscores (Shift + _ _) to create a subscripted name called a literal subscript.
Note that the atomic variable x is different from the indexed one.
Again, note the following example with Array:
>
|
|
| (12.8) |
The following indexed subscript returns the element in the first position of Array (equivalent to A[1]):
However, once subscript is converted to an atomic variable, it evaluates in this manner:
This is equivalent to calling A__1.
In addition to the ability to compose objects to construct semantically different objects, you can also use color. When an automatic atomic object contains colors different from the default, these become part of the atomic object. If the View>Atomic Variable option is set, then all atomic variables, including ones with non-default colors, are shown in magenta. It is recommended that you avoid using the default input and output colors (black and blue) to distinguish objects.
For example, you can construct the name that is different from by changing the color of an to . Select the . From the Context Panel select 2-D Math>Format>Color. Select green, and click OK. To make it atomic, select the green , and from the Context Panel select 2-D Math>Convert To>Atomic Variable.
And as an example of using green in a for loop:
>
|
|
Top of the page
|
|
|
|
|
|
|