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
Executable and Nonexecutable Math
Multiplication
2-D Operators
Separators while Programming in 2-D Math
Derivative Notation and Implied Dependency
Vector Calculus
Special Functions
Generalized Operators and Equations
Tolerances/Optional Forms
Logic
Atomic Variables (Literal Names)
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.
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
Return, Mac
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
In general, you can use * or a space to imply multiplication. In 2-D math, * appears as a center dot (⋅).
2⋅a⋅a3
2⁢a4
expandx+a⋅x+b
a⁢b+a⁢x+x⁢b+x2
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: x x = x2
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:
2 x2
x
expandx+1x
x2+x
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
2 x = 2⁢x
Not valid
2⁢3
Error, missing operation
2.3 5.3333333333
2⋅3 = 6
2.3⋅5.3333333333 = 12.26666667
23 53 = 109
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
x x = x2
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.
expandx⋅x+1 = x2+x
expandf⋅x+1 = f⁢x+f
No space between f and x
The expression parses differently than
expandf ⋅x+1 = f⁢x+f
because without the space it means function application.
expandfx+1 = f⁡x+1
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.
a≔0:
cos⋅a = 0
cosa = 1
In addition, by default, expressions like 2x and 2.1667y 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:
Typesetting:-Settingsnumberfunctions=true:
2x
2
Typesetting:-Settingsnumberfunctions=false:
2⁢x
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 + Space, Windows
Ctrl + Shift + Space, Linux
These are also available on the Expression and Calculus palettes.
Examples
Steps
Definite sum:
∑i=1ni = n+122−n2−12
Type sum and use command completion to select ∑
Press Ctrl + ' and type i=1
Use Right Arrow key to exit subscript
Press Ctrl + Shift + " and type n
Use Right Arrow key to exit superscript
Type i
Alternatively:
Type sum and use command completion to select ∑lr⁡f
Press Tab to move between placeholders and replace:
l with i=1
r with n
f with i
Directional limit:
limx→0+1x = ∞
Type lim or limit, press Ctrl + ' , type x ->0+
Press Right Arrow key
Type 1x
Type lim and use command completion to select limx→a⁡f
x with x
a with 0+
f with 1x
limitx→0−1x = −∞
Type lim or limit, press Ctrl + ' , type x ->0−
Integrals require a special character for the 'd' prefix of the integration variable (DifferentialD):
∫010x ⅆx = 50
Type int and use command completion to select ∫
Press Ctrl + Shift + _ and type 0.
Press Shift + ^ and type 10
Type x d and use command completion to select the Differential'd'
Type x
The integration limits can also be entered over and under the integral sign:
Press Ctrl + ' and type 0
Press Ctrl + Shift + " and type 10
In addition, many formatted 2-D notations are directly available in the command-symbol completion mechanism. This alternative entry technique is demonstrated here:
Type intand use command completion to select ∫abfⅆx
a with 0
b with 10
f with x
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: ∫x ⅆx = ∫xⅆx
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.
Type Int and use command completion to select ∫fⅆx
Press Tab to replace the placeholders f and x with x
Using palettes:
The active (noninert) functions can be entered from the palettes. You can then convert the expression to its inert form.
From the Expression or Calculus palette, select the template ∫fⅆx.
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
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.
use LinearAlgebra in y≔a z≔a end use
Error, unterminated 'use'
This issue can be resolved by adding a semicolon after the first statement.
use LinearAlgebra in y≔a; z≔a end use
z≔a
To suppress the output, use a colon after the end use statement:
use LinearAlgebra in y≔a; z≔a end use:
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.
restart
Prime Notation
Prime notation, by default, uses the variable x. When entering a derivative in prime notation, if no dependency is present, then the function is assumed to be a function of x. For example:
f''
ⅆ2ⅆx2f⁡x
y'+3 y =0
ⅆⅆxy⁡x+3⁢y⁡x=0
If an explicit dependency is present, the function is assumed to be the derivative of a function of x evaluated at that value. If the dependent variable is not assigned, or is a known function (like sin), then D notation is used:
f'''0
D3⁡f⁡0
To enter the prime notation:
Type the expression in math mode, or
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:
q ≔ procx 'procname'x; end proc:
q''0
ⅆ2ⅆx2q⁡xx=0|ⅆ2ⅆx2q⁡xx=0
The variable becomes more important when prime is applied to an expression, as follows:
x2+x'
2⁢x+1
Dot Notation
Dot notation, by default, uses the variable t, so names with a dot and no dependencies explicitly listed are assumed to depend on t:
f..
ⅆ2ⅆt2f⁡t
y.+3 y =0
ⅆⅆty⁡t+3⁢y⁡t=0
The dot notation can be entered in one of the following ways:
Using keyboard shortcuts
Using palette templates
Type f
Press Ctrl + Shift + "
Type ..
Use the Right Arrow key to leave the superscript position
Select A.. from the Calculus palette
Replace A with f
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 t evaluated at that value:
f..0
D2⁡f⁡0
To enter the dot notation:
Type 0
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 ⅆⅆt notation:
Typesetting:-Settingstypesetdot=true:
f..⁡t
y.⁡t+3⁢y⁡t=0
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:
ⅆⅆ x x2+x
ⅆ2ⅆx2 x2+x
To enter the Leibniz notation for univariate differentiation, select ⅆⅆx⁡f and ⅆ2ⅆx2⁡f , respectively, from the Calculus palette and press Tab to fill in the contents.
Multivariate examples:
∂∂ xx2 y
2⁢x⁢y
∂2∂ x⁢∂ y x2+y2+z2
y2+z2
To enter the Leibniz notation for multivariate differentiation, select ∂∂x⁡f and ∂2∂x⁢∂y⁡f , 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:
Typesetting:-Suppressfx,y
∂∂ x f
∂f∂x
This typeset enables short-form entry of function names as well:
f
To enable repeated index notation for partial derivatives, use the following command:
Typesetting:-Settingsuserep=true:
fx,x,y
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.
Dot Product
Type <1,2>.<0,1>:
1,2.0,1
Cross Product
withVectorCalculus:
Type &x as cross-product operator:
1,2,3 &x 7,8,0
Or, use × from the Common Symbols palette:
1,2,3×7,8,0
In the following example, note the change in display of output for 1,2,3×7,8,0 after unloading the package.
unwithVectorCalculus:
−2421−6
Gradient
The coordinate system can be specified within individual calls:
Gradientx2+y2+z2, x,y,z
Or, set coordinate system as follows:
SetCoordinates'cartesian'x,y,z:
Choose from one of the following input style:
Nablax2+y2+z2
Delx2+y2+z2
Gradientx2+y2+z2
From the Common Symbols palette, select ∇, or type nabla and use command completion to select ∇. Alternatively, type Gradient, select ∇x and enter the vector field.
∇x2+y2+z2
Note: For computation using other coordinate systems, see VectorCalculus[Coordinates].
Divergence
Use one of the following methods:
Nabla . x2,y2,z2
2⁢x+2⁢y+2⁢z
Del . VectorFieldx2,y2,z2
The vector field can be assigned separately as well:
V≔VectorFieldx2,y2,z2
∇.V
DivergenceV
From the Common Symbols palette, select ∇ followed by · . Alternatively, type Del or Nabla to enter the Del operator, or type Divergence, select ∇·x and enter the vector field.
∇·x2,y2,z2
Note: For computation using other coordinate systems, see VectorCalculus/Coordinates.
Curl
Nabla &x VectorFieldx y,y,z
Del &x VectorFieldx y,y,z
CurlVectorFieldx y,y,z
Create the vector field separately:
C ≔ VectorFieldx y,y,z
CurlC
From the Common Symbols palette, select ∇ followed by × . Or, type Del or Nabla to enter the Del operator, or type Curl, select ∇×x and enter the vector field.
∇×x y, y,z
Laplacian
Laplacian in Cartesian coordinates:
Laplacianx2+y2+z2
6
Laplacian using polar coordinates:
Laplacianr+θ ,'polar'r,θ
1r
Laplacian using cylindrical coordinates:
Laplacianr+cosθ+z, 'cylindrical'r, θ,z
1−cos⁡θrr
Use expressions of the form (Del . Del)(f), Del . (Del(f)), or Del . Del(f):
∇·∇x2+y2+z2
∇·∇x2+y2+z2
Type Del or Nabla to enter the Del operator, or type Laplacian, select ∇2x and enter the vector field. Alternatively, press Shift + ^ to enter 2 as exponent of Del. Use right arrow key to leave exponent.
From the Expression palette, select ab. Use the Tab key to move between placeholders and replace a with ∇ (available in the Common Symbols palette) and b with 2.
∇2x2+x2+x2
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).
For example,type BesselJ, use command completion to select Jv⁡x, and press Tab to replace v with v and x with x. Similarly, enter the BesselI function.
expr≔Jvx+Ivx
expr≔BesselJ⁡v,x+BesselI⁡v,x
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 I and select Iv⁡x.
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.
TypesettingEnableParseRuleBesselJ,BesselY,BesselI,BesselK:
Now you can enter Bessel functions in standard notation. Type input as shown:
expr⁢≔ Jvx+Ivx
expr≔Jv⁡x+Iv⁡x
Special Function Display in Output
You can change the display of special functions in the output using the Typesetting:-EnableTypesetRule command.
TypesettingEnableTypesetRuleTypesettingSpecialFunctionRules:
expr
Jv⁡x+Iv⁡x
Note: Under standard typesetting mode, the option for typeset display of special functions has no effect:
interfacetypesetting=standard:
BesselJ⁡v,x+BesselI⁡v,x
interfacetypesetting=extended:
You can also control the typeset display for individual special functions through the Typesetting Rule Assistant.
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
expr⁢≔ a ≪b;
expr≔a≪b
expr is actually stored as a function with function name `≪`. If you enter the following:
op⁡0,expr
≪
evalexpr,≪=a,b→a+b
a+b
Enter the much less than operator from the Relational palette.
a≤x≤b
a≤x≤b
The ≤operator can be entered in one of the following ways:
Type <=
Type leq and use the command completion method
Select the operator from the Relational palette
Following is an example which demonstrates that any non-equivalence operators have higher precedence than multiplication:
a⋅b ⊠ c⋅da⋅d
b⊠c
Now, compare this result to the the following:
a⋅b+c⋅da⋅d
a⁢b+c⁢da⁢d
Here the multiplication operator has higher precedence.
For the first example:
Select the ab template from the Expression palette
Type a*b
To enter the boxtimes operator, type boxtimes and use the command completion method.
Type c*d
Press Tab to enter a*d as denominator
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.
whichval⁢≔ 'whichval':
&+−⁢:=⁢a→ifwhichval=1,a,if⁡whichval=2,&uminus0;a,'&+−'a:
&−+⁢:=⁢a→if⁡whichval=1,−a,if⁡whichval=2,a,'&−+'a:
An optional equation using ±and/or ∓:
ans⁢:=⁢x2±x+1x⁢∓2:
At this point, the value of 'whichval' lets you change the value of the expression:
whichval≔1:
ans
x2+x+1x−2
whichval≔2:
x2−x+1x+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:
with⁡Tolerances:
5⁢±0.3
5.00 ± 0.300
1⁢±0.1⁢⋅⁢2⁢±0.1
2.01 ± 0.300
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⁢a = nota
¬a = nota
nand
a⁢nand⁢b = notaandb
uarr
a⁢↑b = notaandb
and
a⁢and⁢b = aandb
a⁢∧b = aandb
nor
a⁢nor⁢b = notaorb
darr
a⁢↓b = notaorb
or
a⁢or⁢b = aorb
a⁢∨b = aorb
xor
a⁢xor⁢b = axorb
veebar
a⁢⊻b = axorb
implies
a⁢implies⁢b = a⇒b
Implies
a⁢⇒b = a⇒b
iff
a⁢iff⁢b = a⇒bandb⇒a
a⁢⇔b = a⇒bandb⇒a
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:
Type a implies
Use command completion to enter ⇒
Type b and press Enter to evaluate
a ⇒b
a⇒b
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.
not⁡a
nota
and⁡a,b
aandb
or⁡a,b
aorb
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.
var⁢≔ x~:
Press Ctrl + Shift + " to enter the overscript for x
Use one of the following methods to enter tilde:
Press Shift + ~
Select ~ from the Common Symbols palette
Type tilde and use command completion method
Use Right Arrow key to leave overscript
This name assigned to var is different from x, and in fact has no relation to x, as it is x tilde.
x≔1:
var
x˜
Assigning the value of x does not affect this name.
Furthermore, x tilde is treated as any other name in Maple.
diff⁡f⁡var,var
ⅆⅆx˜⁢f⁡x˜
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.
x@,x&,x.
x@,x&,x.
To enter the superscript for x 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:
sprintfx~
#mover(mi("x"),mo("˜"))
If this automatic behavior is not desired, it can be disabled through the Typesetting Settings command or through the Typesetting Rule Assistant:
Typesetting:-Settingsautoatomic=false:
x@
Error, invalid power
Expressions that would normally parse as Maple objects can be converted to atomic objects using the context menu. For example, x with a subscript of 1 is normally interpreted as a table reference:
x1
11
Note that this returns '1' subscripted by '1' because x was assigned to 1 earlier.
To work with this notation as a name, different from x, enter the expression, select it, then from the Context Panel select 2-D math>Convert To>Atomic Variable and evaluate.
x__1
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:
A≔0,1,3,4
A ≔ 0,1,3,4
The following indexed subscript returns the element in the first position of Array A (equivalent to A[1]):
A1
0
However, once A subscript 1 is converted to an atomic variable, it evaluates in this manner:
A__1
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 green x that is different from x by changing the color of an x to green. Select the x. From the Context Panel select 2-D Math>Format>Color. Select green, and click OK. To make it atomic, select the green x, and from the Context Panel select 2-D Math>Convert To>Atomic Variable.
And as an example of using green x in a for loop:
for x to 5 do printx,x; end do
1,1
2,1
3,1
4,1
5,1
See Also
2-D Math
2-D Math Shortcut Keys
Entering Expressions
Typesetting Package
Typesetting Rule Assistant
Quick Help Details
Download Help Document