Maple Portal for Students Examples
Back to Student Portal Details
Constructing algebraic objects
Algebraic manipulations
Differential calculus in one variable
Integral calculus in one variable
Multivariate calculus
Vector calculus
Complex arithmetic
ODEs
Linear algebra
Numerical analysis
Units, errors, and tolerances
Recurrence equations
Example 1.1 - How Do I Enter a Piecewise Function?
Follow the steps below to define the function fx=2 x+1x<13−4 x1≤ x<25x≥2 .
Step
Description
Illustration
1
Start by writing the function definition as f≔x→. See How do I... enter a function?
2
To enter a piecewise function, click on the piecewise template from the Expression palette. This palette is located on the left-hand side of the Maple window.
3
Overwrite −x with 2 x+1.
Press Tab to move to the next field, and change x<a to x<1.
Overwrite x in the second row with 3−4 x.
Change x≥a to 1≤x<2.
4
To add another row to the piecewise template, hold down Ctrl+Shift and press R.
↓
5
Now fill in the values for the third row in place of the question marks.
Example 1.2 - How Do I Assign a Name to an Equation or Expression?
Assignments
To assign a value to a variable, enter a colon followed by an equal sign.
In the example to the right, the variable a stores the expression 5 x.
a≔5 x
a≔5⁢x
a
5⁢x
Alternatively, the assignment can be made after the fact. That is, after a value is obtained from a calculation, it can be assigned to a name by using the Context Menu.
Enter and execute the calculation to be assigned. From the Context Panel for the result, select Assign to a Name from the context-sensitive options. Enter a name in the dialog that appears, and click OK.
Equations
In Maple, an equation is defined as two expressions separated by a single equal sign.
It is important to note the difference between an equation and an expression. The Context Panel for an expression or an equation will bring up different options, since there are some operations that can be performed on expressions but not on equations, and vice versa. For example, expressions can be factored or (explicitly) differentiated whereas equations cannot be.
MapleExpression ≔ x2+x−2;
MapleExpression≔x2+x−2
MapleEquation ≔ y=x2+x−2;
MapleEquation≔y=x2+x−2
It is also important to note that when Maple is asked to solve an expression, it assumes that the expression is equal to zero.
x2+x−2→solutions for x1,−2
Example 1.3 - How Do I Construct a Loop?
Loops are used to execute code multiple times. In Maple there are two types of loops: do loops and while loops. do loops are used to execute code a given number of times, and while loops continue execution as long as a given condition is met.
Structure of a do Loop
Structure of a while Loop
for variable from start to finish do statements end do:
while condition do statementsend do:
Example 1: Behavior of a basic do loop
b ≔0:for a from 1 to 3 do b ≔ b+10: a:end do;
Place the cursor in the block of code and press [Enter] to execute the code. Try replacing the semicolon after end do with a colon and press [Enter] again; notice that there is no output. Using a colon, :, suppresses the output for every step, while using a semicolon, ;, allows the user to see the output.
Example 2: Use of a print statement in a loop
b ≔0:for a from 1 to 3 do b ≔ b+10: a: printb:end do:
Upon executing this code, notice that there is output even though a colon is used after end do. This is the result of the print command. This is valuable if you do not want all the variables to be displayed when a complex loop is executed, but you do want to display some output.
Example 3: Nested while loops
a ≔0:b≔0: while a<4 do a≔a+1: while b>−4 do b≔b−1: end do; c≔a⋅bend do;
Note that the calculations in the inner loop are not displayed. In Maple, only the calculations in the outermost loop display, even if a semicolon is placed after the inner loop's end do.
Note: While writing loops, press [Shift][Enter] to move to a new line. Pressing [Enter] alone causes Maple to execute the incomplete loop, resulting in the following error:
Example 1.4 - How Do I Enter the Exponential Function, ⅇx?
To enter the exponential function ⅇx in Math mode, you can use the Expression palette, Command Completion, or the command exp.
In Maple Input mode, use the command exp.
Method
Using the Expression Palette
To enter the exponential function, click on the exponential template from the Expression palette. This palette is located on the left hand side of the Maple window.
Overwrite a with x.
→
Command Completion
Start by typing e in Math mode. You can then obtain the exponential function by using Command Completion (Press Esc).
To enter the exponential ⅇ, select the first item from the list.
Then press Shift+^ to raise the cursor to the superscript position, and type in the power, x.
→ →
An alternate method is to scroll down the Command Completion list and find ⅇx.
exp(x)
This command works in both Math and Maple Input modes.
expx
ⅇx
exp(x);
Note: Just typing ex does not create the exponential function. Use one of the methods above to associate the letter e with the mathematical meaning of the exponential function.
Example 1.5 - How Do I Enter logax Using the Expression Palette?
To enter the logarithmic function with base a, click on the appropriate log template from the Expression palette. This palette is located on the left-hand side of the Maple window.
thismaplet
Overwrite the placeholders b and a with a and x, respectively, moving between placeholders by pressing Tab.
Example 1.6 - How Do I Convert an Expression to a Function?
Type an equation of the form name = expression
Context Menu: Assign Name
a=x2→assign
Type the equation fx=a
Context Menu: Assign Function
fx=a→assign as functionf
Notes
The expression can be referenced by a name or by an equation label.
The function name can be any valid, previously unassigned name.
Example 2.1 - How Do I Import Data into the Curve Fitting Assistant?
To launch the Curve Fitting Assistant, go to Tools → Tutors → Statistics → Curve Fitting ...
When the Assistant is launched, the dialog box appears as shown. Click on
Import to select a data file.
A dialog window appears where you can navigate to your data file. Maple supports various file types, so from this new dialog, select the file from which you wish to import data and select the file type.
For this simple example, data is imported from a text file called "Import data test". The image below shows the contents of this sample data file. Note that the first line is purely text, and the second is blank.
When you are done, click Next. The Import Data Dialog shown to the right appears.
The first two non-data lines in the Data file must be skipped by setting the Skip Lines parameter to 2.
The source form can also be specified. Note that the Curve Fitting Assistant only accepts Rectangular data.
When you have chosen your desired options, click Done to return to the Curve Fitting Assistant.
The imported data now appears in the table of Independent and Dependent Values, as shown to the right. Note that the third column of data in the Data file is ignored.
Click Fit to open the main window of the Curve Fitting Assistant, as shown below.
The Plot buttons on the right generate plots of different interpolating functions.
Click Done to close the Assistant and return the algebraic expression shown in the bottom left-hand corner beneath the plot, or the displayed plot.
Example 6.1 - How Do I Use the Limit Methods Tutor to Evaluate a Limit Stepwise?
Load the Student[Calculus1] package (Tools → Load Package → Student Calculus 1), and enter the expression whose limit is to be computed. Then, from the Context Panel, select:
Student Calculus 1 → Tutors → Limit Methods.
Note that the mathematical expression has been automatically inserted into the Function field.
By default, this Tutor evaluates the limit of the function at zero, but this number can be changed. Also, the direction in which the limit is taken can be specified.
The message box displays hints and explicitly states the rules as they are applied. Note that these hints are suggestions as to what might be a reasonable next step, and do not necessarily give the best method.
Click on a Rule button to implement that rule.
Click Help in the task bar to give a more thorough explanation of all the functions of the Tutor.
Click Undo to reverse the last step. Next Step advances the calculation by one step. All Steps provides all the steps needed for a complete solution.
The Close button does not serve the same function as the x in the top right-hand corner of the window.
Click Close to close the Tutor and return all the displayed steps; click the x in the top right-hand corner to cancel the tutor and return nothing.
Example 6.2 - How Do I Use the Differentiation Methods Tutor to Differentiate Stepwise?
Load the Student Calculus 1 package (Tools → Load Package → Student Calculus 1), and enter the expression to be differentiated. Then from the Context Panel, select: Student Calculus 1 → Tutors → Differentiation Methods.
The white box displays hints and explicitly states the rules as they are applied. Note that only for the Differentiation Methods Tutor are these hints to be taken as the best possible solution (for other Tutors, they are merely suggestions).
When you are finished with the tutor, click the x in the upper right-hand corner of the window to cancel and close the tutor, or click Close to import the last calculation into your worksheet.
Click Help in the Integration Methods Tutor task bar to give a thorough explanation of all the features of the Tutor.
Note
If the Context Panel is used to launch the tutor on an unevaluated derivative, Maple will evaluate the derivative before inserting it into the tutor. For example, the expression ⅆⅆ x 3⋅x2 will be entered in the Tutor as 6 x.
To prevent this premature evaluation, convert the differential expression to inert form, or simply delete ⅆⅆ x from the expression before launching the tutor.
To convert an expression to inert form, from the Context Menu, select: 2D-Math → Convert To → Inert Form.
An inert mathematical operator is gray (not black), as in the operation ⅆⅆ x in the illustration to the right.
ⅆⅆ x3⋅x2
Example 6.3 - How Do I Differentiate Using the Expression Palette?
To enter a differential expression, click on the ⅆⅆx⁡f template from the Calculus palette. This palette is located on the left-hand side of the Maple window.
Select either the differential expression ⅆⅆx⁡f for a single-variable expression, or the partial differential expression ∂∂x⁡f for a multivariable expression.
Overwrite the placeholders f and x, using the Tab key to move to the next placeholder.
The function f should be included within brackets (without brackets, only part of the function may be evaluated, giving unexpected results).
The templates ⅆⅆx⁡f and ∂∂x⁡f perform the same task, for a single-variable expression.
To differentiate with respect to another variable, simply change x to the desired variable.
ⅆⅆ x 5⋅x = 0
ⅆⅆ x 5⋅x = 5
∂∂ x 5⋅x = 5
ⅆⅆ t t2+3 ⋅t+4 = 2⁢t+3
Example 6.4 - How Do I Use the Derivatives Tutor to Obtain a Plot of a Function's Derivative(s)?
Load the Student[Calculus1] package (Tools → Load Package → Student Calculus 1), and enter an expression. Then from the Context Panel, select: Student Calculus1 → Tutors → Derivatives.
Note that the function has been inserted automatically into the tutor as fx.
The default range for the plot can be changed. The first and second derivatives can be displayed, along with the plot of the function.
Click Display to redraw the plot. When you are finished with the tutor, click the x in the upper right-hand corner of the window to cancel and close the tutor, or click Close to export the plot to your worksheet.
Click Help in the Derivative Tutor task bar to give a thorough explanation of all the features of the Tutor.
Example 6.5 - How Do I Launch the Taylor Approximation Tutor from the Context Menu?
Tools → Load Package: Student Calculus 1
Loading Student:-Calculus1
Context Menu: Student Calculus1 → Tutors → Taylor Approximation
Example 7.1 - How Do I Use the Integration Methods Tutor to Evaluate an Integral Stepwise?
Load the Student[Calculus1] package, and then start the Integration Methods Tutor by using the Context Menu for an expression or inert integral:
Context Menu: Student Calculus1 → Tutors → Integration Methods.
Note that the integrand is automatically entered in the Function field.
Integration can be done stepwise by clicking on the appropriate rule button, or by clicking the Next Step or All Steps buttons.
The message box displays hints and explicitly states the rules as they are applied. Note that these hints are suggestions as to what might be a reasonable next step, and do not necessarily give the best possible method.
Example 7.2 - How Do I Enter and Evaluate ∫fxdx or ∫abfxⅆx Using the Expression Palette?
To enter and evaluate an integral, click on the appropriate integration template from the Calculus palette. This palette is located on the left-hand side of the Maple window.
For an indefinite integral, overwrite the placeholder f with the desired function. To integrate with respect to a different variable, you must also overwrite x.
For a definite integral, the upper and lower limits, a and b, must also be overwritten. Use the Tab key to move between placeholders.
Press Enter to evaluate the integral on a new line (shown to the right), or press Ctrl+= (Command+= in Macintosh) to evaluate the integral inline (shown below).
∫3 x2+2 x+5 ⅆx = x3+x2+5⁢x
Example 7.3 - How Do I Enter and Evaluate an Integral Using Command Completion?
Start by typing int, and then use Command Completion (Press Esc). Select int (definite) for definite integrals or int (indefinite) for indefinite integrals.
For a definite integral the upper and lower limits, a and b, must also be overwritten. Use the Tab key to move between placeholders.
Press Enter to evaluate the integral on the next line (shown to the right), or Ctrl+= (Command+= in Macintosh) to evaluate the integral inline (shown below).
The integral sign itself can be found in the Common Symbols palette or in the Command Completion list if int is typed. Using this symbol, you can construct an integral and evaluate it. However, to prevent the error:
the d symbol must be entered as an operator. After typing d, use Command Completion. Select the first item from the list, d(differential). Note that the differential d is not italicized, while a normally typed d is italicized in Math mode.
∫5 x4+3 x3+2 x2+4 x+7 ⅆx =
Example 7.4 - How Do I Use the Approximate Integration Tutor to Approximate a Definite Integral?
Load the Student[Calculus1] package, and then start the Approximate Integration Tutor by using the Context Panel for an expression or inert integral:
Context Panel: Student Calculus1 → Tutors → Approximate Integration.
Note that the integrand is automatically inserted as fx.
The lower and upper limits of integration are given by a and b, respectively. The interval is divided into n subintervals, the number of partitions.
Click on the Riemann Sums and
Newton-Cotes Formulae buttons to change the method of approximating the integral.
If partition type Normal is chosen, the function is evaluated at the number of nodes determined by n, the number of partitions.
If partition type Subinterval is chosen, the function is evaluated at additional nodes between the uniformly spaced ones determined by n.
Click the Display button to redraw the plot showing the approximate value of the definite integral. Click Animate to show dynamically the effect of increasing the number of partitions. Plot Options allows you to modify properties of the plot. Compare compares the values obtained by each approximation method. Close closes the Tutor and inserts the plot into the worksheet.
Click Help in the Approximate Integration Tutor task bar to give a thorough explanation of all the features of the Tutor.
Example 7.5 - How Do I Launch the Function Average Tutor from the Context Menu?
Context Panel: Student Calculus 1 → Tutors → Function Average
Example 7.6 - How Do I Launch the Arc Length Tutor from the Context Menu?
Context Panel: Student Calculus 1 → Tutors → Arc Lengths
Example 7.7 - How Do I Launch the Volume of Revolution Tutor from the Context Menu?
Context Panel: Student Calculus 1 → Tutors → Volume of Revolution
Example 7.8 - How Do I Launch the Surface of Revolution Tutor from the Context Menu?
Context Panel: Student Calculus 1 → Tutors → Surface of Revolution
Example 8.1 - How Do I Launch the Gradients Tutor from the Context Menu?
Tools → Load Package: Student Multivariate Calculus
Loading Student:-MultivariateCalculus
Context Panel: Student Multivariate Calculus → Tutors → Gradients
Example 8.2 - How Do I Launch the DirectionalDerivative Tutor from the Context Menu?
Context Panel: Student Multivariate Calculus → Tutors → Directional Derivatives
Example 8.3 - How Do I Launch the Taylor Approximation Tutor from the Context Menu?
Context Panel: Student Multivariate Calculus → Tutors → Taylor Approximation
Example 8.4 - How Do I Enter an Iterated Integral with the Expression Palette?
To enter and evaluate a definite iterated integral, click on the definite integration template from the Calculus palette. This palette is located on the left-hand side of the Maple window.
Press Tab twice to move the highlighted field over the placeholder f. Click on the definite integral template a second time. The integral is now an iterated double integral.
Repeat the process to produce a higher order iterated integral.
Press Tab to move between the placeholders, and overwrite all the colored parameters. Press Shift+Tab to move to the previous placeholder, if you have not already overwritten it.
To evaluate the integral, press Enter to display the value on a new line, or Ctrl+= (Command+= in Macintosh) to display the value inline.
f≔x→x2+3 x+2: ∫13∫f0f2x2⋅y ⅆx ⅆy = 68803
∫f0f2∫13x2⋅y ⅆy ⅆx = 68803
Example 8.5 - How Do I Launch the Approximate Integration Tutor from the Context Menu?
Context Panel: Student Multivariate Calculus → Tutors → Approximate Integration
Example 9.1 - How Do I Attach a Coordinate System to a Free Vector?
Tools→Load Package: Vector Calculus
Loading VectorCalculus
Use syntax such as that shown to the right to define the vector in a particular coordinate system. The default display uses explicit basis vectors.
V≔Vector1,2,3,coords=sphericalρ,φ,θ
To change the display of the vector to column notation, change the default value of BasisFormat.
BasisFormatfalse: V
Use the About command to extract information about the vector.
AboutV
Type: Free VectorComponents: 1,2,3Coordinates: sphericalρ,φ,θ
Use the GetCoordinates command to extract the coordinate system and the names of the coordinate variables.
GetCoordinatesV
sphericalρ,φ,θ
Use the attributes command to extract the vector's attributes, which here are its coordinate system.
attributesV
coords=sphericalρ,φ,θ
Example 9.2 - How Do I Compute a Gradient Interactively with ∇?
Set a coordinate system, as, for example, with the SetCoordinate command.
VectorCalculus:-SetCoordinatescartesianx,y
cartesianx,y
Apply the Nabla ∇ or Del operator from the Common Symbols palette.
Context Menu: Evaluate and Display Inline
∇x2+y2 =
Example 9.3 - How Do I Compute a Divergence Interactively with ∇?
Define a vector field.
F≔VectorCalculus:-VectorFieldx,y,cartesianx,y
∇·F = 2
Example 9.4 - How Do I Compute a Curl Interactively with ∇?
VectorCalculus:-SetCoordinatescartesianx,y,z
cartesianx,y,z
F≔VectorCalculus:-VectorFieldy2,z2,x2,cartesianx,y,z
From the Common Symbols palette, apply the Nabla ∇ or Del, and the cross-product operators.
∇×F =
Example 9.5 - How Do I Compute a Laplacian Interactively with ∇?
∇2x2+y2 = 4
Example 9.6 - How Do I Implement the Frenet-Serret Formalism Interactively?
Enter the space-curve in a radius-vector format.
Context Menu: Select from any of the following options: TNBFrame, Tangent Vector, Principal Normal, Binormal Vector, Curvature, Torsion, Radius of Curvature
cosθ,sinθ,θ
Example 9.7 - How Do I Change Coordinates of a Point ?
Enter a Cartesian point in the plane. Note that points are expressed as "free vectors" in the Vector Calculus packages.
p≔a,b
Apply the MapToBasis command, changing from Cartesian to polar coordinates.
MapToBasisp,polar
Note that in non-Cartesian spaces, points are represented by the analog of a free vector in a rectangular instantiation of the non-Cartesian space. This "vector" is a representation only, the "basis vectors" simply indicating the names of the new coordinates.
Example 9.8 - How Do I Change Coordinates in a Vector Field?
In Cartesian coordinates, define a vector field F.
F≔VectorField1,0,0,cartesianx,y,z:
Express F in spherical coordinates.
MapToBasisF,sphericalρ,φ,θ
Note the overbars on the basis vectors. These are true unit basis vectors, defined at all points in the field. Theoretically, these vectors are functions of position, but here in Maple, they are simply symbols that do not actually carry with them any information about the point at which they sit.
Example 10.1 - How Do I Enter a Complex Number?
Feature
Enter Complex Number
In Maple, the default representation of the imaginary unit i=−1 is I.
To enter the imaginary unit in Maple, click on one of the symbols ⅈ, ȷ, or I from the Common Symbols palette, found on the left-hand side of the Maple window. Typing the letter I is equivalent to selecting it from this palette
Shown at the right are a few examples of complex numbers.
Note that simply typing i will not produce the imaginary unit, but typing I will.
Also, the imaginary unit i=−1 is displayed with a capital I, no matter which symbol was used for input.
3⋅ⅈ+5⋅5−3⋅ⅈ = 34
3⋅ⅈ+4 = 4+3⁢I
Typing i is not recognized as the imaginary unit.
3⋅i+4⋅4−3⋅i = 3⁢i+4⁢4−3⁢i
3⋅ȷ+5⋅5−3⋅ȷ = 34
3 ⋅ȷ+5 = 5+3⁢I
3⋅I+5 = 5+3⁢I
Change
Symbol
To change the symbol used for the imaginary unit, (both for input and output), use the interface command as shown to the right. This command sets j to be the imaginary unit. Thereafter, clicking on i, j, or I in the Common Symbols palette, or typing the letter j,will produce the imaginary unit, and its symbol will be ȷ.
interfaceimaginaryunit=j:
From the palette:
ȷ2 = −1
By typing:
j2 = −1
In computations:
1+2⋅j⋅j = −2+ȷ
Command
The Complex command may also be used to enter complex numbers.
Complex5,2 = 5+2⁢I
Example 11.1 - How Do I Enter an Ordinary Differential Equation?
Palettes
To enter an ordinary differential equation in Math mode, type it as you would write it. The prime symbol can be entered using the Common Symbols palette or by typing an apostrophe, [']. Higher-order derivatives can be entered with multiple apostrophes, or by using the symbols in the Punctuation palette. (If you cannot see this palette, open it by selecting View → Palettes → Show Palette → Punctuation.)
By default, primes indicate differentiation with respect to x.
Maple also recognizes higher derivatives expressed with exponents in parentheses: f5x is interpreted as the fifth derivative of f with respect to x.
y'+y''=2 x
ⅆⅆxy⁡x+ⅆ2ⅆx2y⁡x=2⁢x
prime
versus
dot
Differential equations can also be entered by using dot notation. This can be done in two ways:
First, type the variable and then press Ctrl+Shift+". This will raise the cursor above the variable. Type a period [.] above the variable name to indicate the derivative. Two dots indicate the second derivative.
The second method of writing differential equations using dot notation is to use the Layout palette. This palette is located on the left-hand side of the Maple window. If you cannot see this palette, select View → Palettes → Show Palette → Layout.
Click on the indicated template and replace A with the desired variable and b with a period. Several periods can be placed over the variable.
By default, dot notation indicates differentiation with respect to t.
y.+y..+y=5
ⅆⅆty⁡t+ⅆ2ⅆt2y⁡t+y⁡t=5
Output
The output display of a differential equation can be modified. This is done by changing the Typesetting settings.
By executing the command TypesettingSettingstypesetprime=true,typesetdot=true prime notation and dot notation are displayed in the output in place of the ⅆⅆ x and ⅆⅆ t notation, respectively.
The command Typesetting[Suppress] can be used to suppress the functional dependency from being displayed in the output.
For example, the command TypesettingSuppressyt:
suppresses t from being displayed in the output.
These settings can also be accessed through the Typesetting Rules Assistant (View → Typesetting Rules) under the heading Differential Options.
ⅆⅆx⁢y⁡x+ⅆ2ⅆx2⁢y⁡x=2⁢x
ⅆⅆt⁢y⁡t+ⅆ2ⅆt2⁢y⁡t+y⁡t=5
TypesettingSettingstypesetprime=true,typesetdot=true:
y′⁡x+y″⁡x=2⁢x
y.⁡t+y..⁡t+y⁡t=5
TypesettingSuppressyt:
y.+y..+y=5
Options
As indicated in the above examples, y′ assumes differentiation with respect to x, while y. assumes differentiation with respect to t. This is the Maple default for the prime and dot notation. This can also be customized using either the Typesetting[Settings] command or the Typesetting Rule Assistant (View → Typesetting Rules).
Maple Input Mode
To enter differential equations in Maple Input mode, use the command diff.
The diff command diff(y(t),t) is equivalent to ⅆⅆtyt.
diff(y(t),t,t)+diff(y(t),t)+5*y(t)=7;
y..+y.+5⁢y=7
ⅆ2ⅆt2⁢yt+ⅆⅆt⁢yt+5⁢yt=7
Example 11.2 - How Do I Solve an ODE Numerically?
Enter the ODE and its initial condition. Use any of of the methods described in Example 11.1 to enter the ODE.
ode≔y.=1−y910,y0=−9991000
ode≔y.⁡t=1−y⁡t910,y⁡0=−9991000
Use the dsolve command with option numeric to obtain the solution.
Obtain the numerical value of the solution for a specific value of t.
To plot the solution use the command plots[odeplot].
odeSolution≔dsolveode,numeric:
odeSolution1
t=1.,y⁡t=0.249396208864589
odeSolution2
t=2.,y⁡t=0.746621871835948
plotsodeplotodeSolution,0..6
Example 12.1 - How Do I Obtain the Dot Product of Two Vectors?
In Maple, a vector can be constructed by a comma-separated n-tuple of numbers within a pair of angle brackets:
Palette
A vector can also be defined by using the Matrix palette. To insert a vector from the Matrix palette, either the number of rows or the number of columns must be equal to one. This will produce a row vector or a column vector, respectively.
You can choose the dimensions of the vector (or matrix) by either entering dimension in the Rows and Columns boxes or by clicking Choose and dynamically sizing the vector (or matrix) using the mouse.
Click the Insert Vector[column] button to insert the vector into the document or worksheet. By clicking the arrow on this button, you can choose to insert a matrix or a vector. Note: this option is only available if the matrix is a single column or row.
Overwrite the fields as needed. Press Tab to move to the next placeholder, and Shift+Tab to move to the previous placeholder.
→ 362
The dot product can be calculated by using Command Completion. After typing or inserting the first vector, type dot and the access the Command Completion list (by pressing Esc). Select dotproduct. Then type the second vector.
3,4,5·2,3,−4 362·123
The dot product can also be calculated by using the centered dot (·) from the Common Symbols palette.
3,4,5·2,3,−4 = −2
Evaluate
Press [Enter] to evaluate the dot product on a new line, and press Ctrl+= (Command+= in Macintosh) to evaluate it inline.
3,4,5.2,3,−4
−2
362·123 = 21
Maple Input
To calculate the dot product in Maple Input mode, enter a period between the vectors.
<3,4>.<-1,1>;
<3,2,-1>.<-2,3,0>;
0
Example 12.2 - How Do I Calculate the Norm of a Vector?
First, load the Student[LinearAlgebra] package (Tools → Load Package → Student Linear Algebra).
Loading Student:-LinearAlgebra
Context Menu
From the Context Panel for an existing vector, select Norm.
Command Completion or Palette
The Norm notation for a vector can be obtained by using Command Completion. Start by typing Norm, and then access the Command Completion list (by pressing [Esc]) and choose the first item, Norm, with double bars around the placeholder x.
The Norm notation can also be found in the Layout Palette. (If this palette is not visible, select View → Palettes → Show Palette → Layout.)
Replace the placeholder x (or A) with a vector. To enter a vector in Maple, see step 1 of Example 12.1.
Press [Enter] to display the value of the Norm on a new line, or [Ctrl][=] ([Command][=], Macintosh) to display the value inline.
34 = 5
Commands
The norm can also be constructed by typing two vertical strokes in succession both before and after the object whose norm is to be computed.
1,2,3 = 14
To calculate the Norm of a vector in Maple Input mode, use the command Norm. An example of this is shown to the right.
This command can also be used in Math mode.
Norm3,4 = 5
Typing lower case norm will not display the same Command Completion list as Norm.
norm and Norm are in fact two distinct commands in Maple.
Example 12.3 - How Do I Calculate the Cross-Product of Two Vectors?
In Math mode, the cross-product of two vectors can be calculated using the cross operator (×) from either the Common Symbols palette or the Operators palette.
Enter the two vectors in any format, with the cross operator between them.
362×123 = 14−70 2,3,−1×4,2,5 = 17−14−8
In Maple Input mode, first load the Student[LinearAlgebra] package. Then you can use the symbol &x as the cross-product operator.
Note that in the example to the right &x has no meaning outside of the package.
<2,3,-1>&x<4,2,5>;
23−1&x425
Example 12.4 - How Do I Calculate the Determinant of a Matrix?
Methods
For an existing square matrix, apply the Context Panel item: Standard Operations → Determinant.
Alternatively, click on the absolute-value template from the Layout palette (if this palette is not visible, select View → Palettes → Show Palette → Layout).
Replace the A inside the vertical lines with the desired matrix or with a reference to it (to enter a matrix in Maple, use the Matrix palette shown in step 1 of Example 12.1).
To obtain notation that looks more traditional, the brackets on the matrix can be deleted without affecting the result.
2358
Press Enter or Ctrl+= (Command+= in Macintosh) to evaluate the determinant.
2358 = 1
Note that double vertical bars on both sides will calculate the norm of the matrix and not the determinant.
2358 = 13
Example 12.5 - How Do I Obtain the Transpose of a Matrix?
For an existing matrix, apply the Context Panel item:
Standard Operations → Transpose.
Alternatively, enter the desired matrix into your worksheet (to enter a matrix in Maple, use the Matrix palette shown in step 1 of Example 12.1).
Press Shift+^ to raise the cursor to the superscript position. Then type %T.
Press Enter or Ctrl+= (Command+= in Macintosh) to evaluate and display the transpose of the matrix.
1234%T = 1324
Hermitian Transpose
The Hermitian transpose of a matrix with complex entries can be obtained by typing %H instead of %T.
5−2I3+I1−4I3−6I%H =
Example 12.6 - How Do I Perform Augmentation or Stacking Operations on Matrices and Vectors?
For this example, define the following matrices and vectors.
Matrix A
Matrix B
Matrix C
Vector a
Vector b
A ≔ 1482
B≔1357911
C≔ B%T
a≔3,3,3
b ≔ 555
Stacking Matrices and Vectors
The command p,q stacks the first matrix or vector, p, on top of the second matrix or vector, q. See the examples below.
A,C
C,A
b,B
B,b
A,C,A
A,B
Error, (in Matrix) this entry is too wide or too narrow: Matrix(2, 3, {(1, 1) = 1, (1, 2) = 3, (1, 3) = 5, (2, 1) = 7, (2, 2) = 9, (2, 3) = 11})
As expected, only matrices and vectors that have the same number of columns can be stacked on top of one another.
Augmenting Matrices and Vectors
The command p|q augments the first matrix or vector, p, with the second matrix or vector, q, by placing it on the right. Multiple augmentation or stacking is possible. See the examples below.
A|B
B|A
C|a
a|C|a
C|a|C, A|B
A|C
Error, (in Matrix) this entry is too tall or too short: Matrix(3, 2, {(1, 1) = 1, (1, 2) = 7, (2, 1) = 3, (2, 2) = 9, (3, 1) = 5, (3, 2) = 11})
As expected, only matrices and vectors that have the same number of rows can be augmented together.
Solving the Linear System Ax=y
Given the matrix A≔3213 and the vector y≔85, find the solution to the linear system Ax=y.
Form the augmented matrix A,y as shown in the previous example.
A|y =
Apply the Context Panel item:
Solvers and Forms → Row-Echelon Form.
→reduced row-echelon form
→fraction-free elimination
→row-echelon elimination
The solution, x, is the right-most column of the reduced row echelon form. This can be read from the matrix itself.
Alternatively, the solution can be displayed directly by applying the Context Panel item Select Elements → Restrict Columns, and enter the index of the last column, in this case, 3.
→restrict columns
Example 12.7 - How Do I Implement Gaussian Elimination by Using the Tutor?
Use the Gaussian Elimination Tutor to solve a linear system Ax=y, where A is 1379, and y is 511.
Start by augmenting the matrix as shown in the example above.
A≔1379:y≔511:
Next, load the Student[LinearAlgebra] package (Tools → Load Package → Student Linear Algebra).
To access the Tutor, from the Context Panel for the output, select: Student Linear Algebra → Tutor → Linear System Solving.
A dialog appears where you can choose the method of solving. Choose Gaussian Elimination.
Note that the matrix is automatically entered into the tutor.
The Edit Matrix button allows you to edit the matrix through the Matrix Builder.
The matrix and the equations it represents are viewable in both matrix and variable form.
The check box Augmented is selected by default. For an augmented matrix, a vertical line is drawn between A and y in the matrix, and the Variables view pane shows the nonhomogeneous equations.
You can change the dimensions of the array by clicking the drop-down boxes under Rows and Columns. Select Square to automatically convert the matrix to a square matrix, adding rows of zeros, if needed.
Click Display to redraw the Matrix and Variables views with the applied changes. Click Close to export the new matrix back to the Gaussian Elimination Tutor.
Gaussian elimination can be performed manually on the matrix by clicking on any of the row operation buttons shown on the right.
Click Undo to remove the last step performed. Click Next Step to perform and display one Gaussian elimination step. Click All Steps to display all steps to the final step of the Gaussian elimination.
After the matrix has been reduced to row echelon form, go to Step 6.
6
To complete the solution by back substitution, click the Solve System button. If the matrix has not been reduced to row echelon form an error displays.
If the augmented matrix is in row echelon form, another window will open.
Click the buttons Equations, Solve x[2], Solve x[1], and Solution, in that order, to manually implement back substitution and display the solution to the linear system.
Click the Change the matrix button to launch the Matrix Builder.
7
Click Cancel to close the Tutor and output nothing.
Click Close to close the Tutor and output a column matrix that represents the solution to the system.
1357911→linear solve tutor
Example 12.8 - How Do I Use the Matrix Inverse Tutor?
To begin, load the Student Linear Algebra package (Tools → Load Package → Student Linear Algebra).
For any square matrix, apply the Context Panel item Student Linear Algebra → Tutors → Matrix Inverse.
Note that Tutors will not appear in the Context Menu unless the Student Linear Algebra package is loaded.
Notice that the matrix is automatically entered into the tutor and augmented with the identity matrix.
Reduce the matrix to the identity manually by clicking on any of the row operation buttons shown on the right.
Click Undo to remove the last step performed. Click Next Step to display one additional reduction step. Click All Steps to complete the reduction and show the inverse.
Click Edit Matrix to change the matrix to be reduced. This button opens the Matrix Builder assistant.
Click Help in the Tutor's task bar to give a more thorough explanation of all the functions in the Tutor.
Click Return the Inverse to close the tutor and display the inverse in your document.
Click Close to cancel the tutor.
Example 13.1 - How Do I Approximate the Roots of an Expression Using Newton's Method?
Steps
First, load the Student[NumericalAnalysis] package (Tools → Load Package → Student Numerical Analysis).
Loading Student:-NumericalAnalysis
Enter the expression.
f≔ ⅇx+cosx−1
f≔ⅇx+cos⁡x−1
Use the Newton command with the initial approximation and the option tolerance to obtain the solution.
This solution is accurate to within 10−5.
To see a plot of this application of Newton's method, use the option output=plot.
Newtonf,x= 1,tolerance=10−5
−0.9626326373
Newtonf,x= 1,tolerance=10−5,output=plot
Example 13.2 - How Do I Approximate the Roots of an Expression Using a Specific Method?
f≔ x3−18 x2−cosx
f≔x3−18⁢x2−cos⁡x
Use the Roots command with the initial approximation(s) and the method option to obtain the solution.
Here, we use the secant method, which requires a pair of initial approximates.
To see a plot of this application of the secant method, use the option output=plot.
Roots⁡f,x=15,20,method=secant
18.00204199
Roots⁡f,x=15,20,method=secant,output=plot
Example 13.3 - How Do I Find the Interpolating Polynomial?
Given data points xi,yi
Enter the data points by entering a list of x-y pairsxi,yi.
Use the PolynomialInterpolation command with the data points and the method option to obtain the solution.
Use expand(Interpolant) to see the interpolating polynomial
data1≔0,1,0.5,0.6,1,0.7,1.5,1.2,2,2.5,2.5,4.9,3,9.1,3.5,16.0,4,26.5,4.5,41.8,5,63.1:
LagrangePoly≔PolynomialInterpolationdata1, independentvar='x',method=lagrange:
expandInterpolantLagrangePoly
−4.22261904⁢x+1.000000000+26.284483⁢x4+15.28467391⁢x2−26.829327⁢x3−15.214723⁢x5+5.4662597⁢x6−1.2212700⁢x7+0.16423283⁢x8−0.012063493⁢x9+0.0003668431⁢x10
Given the function and x-values
Enter a list of x-values.
Use the PolynomialInterpolation command with the x-values, a function, and the method option to obtain the solution.
xvalues≔0,0.4, 0.8, 1.2, 1.6, 2.0, 2.4, 2.8, 3.2, 3.6, 4.0:
LagrangePoly2≔PolynomialInterpolationxvalues,function= ⅇ2⋅x, independentvar='x',method=lagrange:
expandInterpolantLagrangePoly2
0.995293⁢x+0.9999999999+34.3857⁢x4+9.2308177⁢x2−19.8277⁢x3−32.4413⁢x5+20.35083⁢x6−8.07530⁢x7+2.04462⁢x8−0.296006⁢x9+0.02008699⁢x10
Hermite interpolation
For Hermite interpolation, enter a list of triples giving xi, yi, and the derivative at that point.
Use the PolynomialInterpolation command with the data points and the method hermite to obtain the solution.
data2≔0,0.99,2.0,0.5,2.7,5.4,1,7.4,15.,1.5,20.,40.,2,55.,110.:
HermitePoly≔PolynomialInterpolationdata2, function=ⅇ2⋅x,independentvar='x', errorboundvar='ξ',digits=4, method=hermite:
expandInterpolantHermitePoly
2.0⁢x−23.2780⁢x8+2.511⁢x9+43.7761375⁢x3−127.3733500⁢x4+201.1540875⁢x5−177.198300⁢x6+88.51450⁢x7−3.6960750⁢x2+0.99
Entering the function and errorboundvar options is not required, but these options are needed if you want to find the error term (see Example 13.4).
Example 13.4 - How Do I Find the Error Term for an Interpolating Polynomial?
First, find the Polynomial Interpolation as described in Example 13.3. You will need to specify the function and the name of the error bound variable using the function and errorboundvar options.
Then, use the command RemainderTerm to find the error term.
RemainderTermHermitePoly
4⁢ⅇ2⁢ξ⁢x2⁢x−0.52⁢x−1.2⁢x−1.52⁢x−2.214175&where0.≤ξ≤2.
Example 13.5 - How Do I Find the Divided Difference Table?
You can find the divided difference table for a polynomial interpolation computed with Newton's method or Hermite's method.
First, find the Polynomial Interpolation as described in Example 13.3.
Then, use the command DividedDifferenceTable.
DividedDifferenceTableHermitePoly
Example 13.6 - How Do I Find the Quadrature Using a Specific Method?
f≔1x+1
1x+1
Use the Quadrature command with the expression, interval, and the method option to obtain the solution. If desired, specify the partitions. (The default is 10 evenly spaced partitions.)
Quadraturef,x=0..4,method=trapezoid,partition=6
1.643600844
Quadraturef,x=0..4,method=trapezoid,partition=6,output=plot
Example 13.7 - How Do I Solve an ODE Initial Value Problem Using Euler's Method?
Enter the ODE. Use any of of the methods described in Example 11.1 to enter the ODE.
DE≔ⅆⅆ t yt=yt+t2:
Use the Euler command to obtain the numerical solution to the ODE with initial value given a specific value of t.
You can choose to output the solution, error, plot, or a table of information.
EulerDE,y0=0.5,t=2
5.197
EulerDE,y0=0.5,t=2, output=Error
3.276
EulerDE,y0=0.5,t=2, output=information
Example 13.8 - How Do I Specify a Numerical Method for Solving Ax = b?
Enter the matrix A and vector b. (To enter a matrix or a vector in Maple, see Example 12.1.)
A,b≔1.0−0.12.0.−0.11.1−0.13.0.2−0.11.0−0.10.0.3−0.10.8,0.62.5−1.11.5:
Use the LinearSolve command with the method option to obtain the solution.
LinearSolveA,b, method=LU
Example 16.1 - How Do I Use Units?
The Units palette provides an easy way to find and apply units to a calculation without having to know the parent unit system that the unit resides in. For example, you may want to enter a unit for Power but do not know, or care about, the parent unit system.
If the Units palette is hidden from the palettes pane, see Show Palettes for instructions on how to display this palette.
A common and useful place to add units to a document is during variable assignment. After entering a value, click the unit you want to attach to that quantity.
dist≔10 → →
dist≔10m:
Units can also be applied by using the Context Panel item: Units → Affix Unit → [desired unit].
s≔yx
s→affix unit coulomby⁢Cx
The results of calculations performed with unit-dependent variables will also have, and display, units.
t≔2s:
speed≔distt = 5⁢ms
To simplify the units of a value or expression, use the Context Panel item: Units → Simplify.
5⁢ms
→simplify units5⁢ms
To specify units not shown in the template, click unit from the Units palette.
Then overwrite unit with your measure of units.
allowance≔5mm:
Example 16.2 - How Do I Convert Units?
To convert from one system of units to another use the Context Panel item: Units → Convert → System → [desired system of units].
5⁢ms→units to FPS system6250381⁢fts
To convert within one system of units, use the Context Panel item: Units → Replace Units.
A dialog box lets you specify the replacement units. Enter the units. The results of the conversion are shown.
10fts
10fts→replace units7511⁢mih
Example 16.3 - How Do I Use Tolerances?
A tolerance of the form ±b is attached to the quantity a by the construct a ±b.
First, load the Tolerances package (Tools → Load Package → Units and Tolerances).
Loading Tolerances
The ± symbol can be entered from the Common Symbols palette or the Operators palette.
l≔2 ±0.2m = 2.00 ± 0.200⁢m
l+l = 4.00 ± 0.400⁢m
10⋅ l = 20.0 ± 2.00⁢m
l2 = 4.04 ± 0.800⁢m2
The ± symbol can also be entered by typing pm and using Command Completion.
Example 17.1 - How Do I Enter and Solve Recurrence Equations in Maple?
A recurrence equation such as un+2+2 un+1− 3 un=0 can be entered in Maple with the syntax shown to the right.
EQ ≔un+2+2 un+1−3 un=0
Recurrence equations can be solved by using the rsolve command.
An initial value problem for a recurrence equation is solved with the syntax as shown to the right.
rsolveEQ, u0=1,u1=2,un
Download Help Document