MAPLE Examples and Tips

Maple worksheets on the web?

If Maple is installed locally on your machine or network, you can just click on the link to a Maple worksheet and it will open. However, when you are using Citrix Maple especially or if Maple is already open, the OPEN URL command from the Maple File Menu is particularly useful for web linked Maple worksheets. Just right click on a hyperlink on a web page pointing to a Maple worksheet and copy the shortcut URL address of the worksheet, then paste it into the OPEN URL window and hit Enter: the worksheet will open quickly, avoiding wasting time saving the worksheet locally first and then browsing to find it and open it with Maple. Of course you should then save it locally if you intend to keep it after executing it.

For the Engineering and Science Calculus course sequence there are example files (perhaps most useful for instructors):

To save these files, please right-click on them and choose Save Link As.

  • MAT1500 Calculus 1 for Science and Engineering - cmdlist1.mw
  • MAT1505 Calculus 2 for Science and Engineering - cmdlist2.mw
  • MAT2500 Calculus 3 for Science and Engineering - cmdlist3.mw
  • MAT2705 Differential Equations with Linear Algebra - cmdlist4.mw

The first example worksheet has many live tips on using 2d math, palettes and right-click menus before starting the calculus examples. You are free to type literally old style 1d math (character mode) found in textbook examples right into the 2d input mode, but you can also take advantage of 2d features while doing so, mixing 1d and 2d entry. Fortunately the Standard Maple "Clickable Calculus" approach makes it very easy to use palette entry and right click menus to do most of what is needed in these courses without special instruction!

These files have their output removed [Edit Menu, Remove Output, All] and must be re-executed by clicking on the Execute Worksheet icon "!!!" on the toolbar. This saves a lot of server space since the executed files can be much larger, especially when 3d graphics are present. However, when executing with "!!!" instead of step by step, sometimes help pages pop up, leading to many simultaneous open windows [Window menu, first file in list is original], or pop up Java applet interactive windows appear (from Tutor commands), each of which must be closed in turn before the worksheet can proceed executing. To execute step by step, just hit the Enter key for each execution of an input group to see its output appear. Then move on to the next step.

The Maple Portal

A great source of guided help for the new and advanced user is the Maple Portal. When you install Maple, it puts two icons on your desktop. The second one is the Maple Portal shortcut which is just Maple opening to an example file in the example folder of the software folder
C:\Program Files\Maple 14\examples\MaplePortal.mw
[You can also get this worksheet from the File menu, Open choice and then navigate to this worksheet.]
It summarizes all the extras Maple has for accomplishing many usual activities in most areas of mathematics usually encountered by college students, as well as providing direct links to online content for Students, Educators, or Engineer/Scientists.

Tips to Remember

Getting Started

  • Standard Maple opens in a blank document, but usually we want to work in a worksheet, with input prompts and separate output regions, so start by using the File menu, and selecting New Worksheet.
    [One can include document blocks in worksheet mode as well through Format Menu, Document Block, which removes the left margin execution grouping line. One can switch to worksheet mode from document mode simply by introducing a prompt. View, Expand Document Block will show the underlying computations hidden in Document mode.]
    Right-clicking on output expressions once entered with the Enter key opens a menu of operations that can be applied to the expression. Maple then inserts the underlying command and the result in a new input/output pair of regions.

    If you choose to start with a New Document instead, there are no input prompts, and results of right-clicking on expressions follow them after an arrow and commands are suppressed. [A few short training videos help the new user understand how to use the Clickable Calculus interface of Standard Maple Document mode: Go to training Videos.]
     
  • 2d math movements
    An important tip for Standard Maple 2d math input (black, math italic) is that you must use the right arrow key to continue inputting an expression after raising to an exponent or dividing by a denominator (using the forward slash for division, asterisk for multiplication), in fact you can use all 4 arrows to move around an expression to edit its various pieces, while when entering from the palette, the tab key moves you through the characters to be replaced. Right clicking on expressions gives you menus to select operations you wish to perform.

    The input mode "1d math = bold red character input" like in help pages) is not the default in Standard Maple (you can change it in Tools, Options, Input Display for the session), but each time you enter a blank input region after the Maple prompt ">" you can click on the leftmost "Text" button on the inside window toolbar to switch to it, while the "Math" button switches back to 2d math input. This can be useful for inputting little Maple programs in a more organized way than the 2d math line breaking spacing rules allow.

Predefined Constants

  • Maple is case-sensitive like mathematics, distinguish uppercase and lowercase letters and be consistent.
    D
    is reserved for Maple function differentiation.
  • Pi is the number π, exp(x) is ex, exp(1) is e
    but in typing Maple,  e or e  is never the Euler number and e^x is never the exponential function
    [use the Common Symbol palette or the Greek letter palette; both entries for
    π now correspond to the 1d math symbol Pi standing for 3.14159...].
    The complex number i = sqrt(-1) is represented by the uppercase letter I in Maple, also available from the Common Symbol palette.
    You still need to know these 1d math names to enter them in the pop up interactive windows, like the plot range in the plot builder for trig functions where ranges like 0.. 2*Pi are frequently required. 

Delimiters, spaces, ranges

  • All Maple commands obey function notation with rounded parentheses (,) enclosing their inputs separated by commas. All groupings overriding the usual rules for order of performing the basic operations are done using matching rounded parentheses only (no brackets or braces of any kind).
  • Square brackets [,] enclose a list of objects (numbers, functions, color names) whose order is to be maintained, like vector components, or a list of functions to coordinate with a list of colors in a plot command.
    [Square brackets are also used for subscripts on vectors or matrices: v[1] becomes v1, A[1,2] becomes A1,2.]
    Curly brackets
    {,} are used to enclose sets of objects whose order is unimportant, as in a set of equations to be solved.
    Triangle brackets < , > are used for listing vector components with entries separated by commas, which appear in the output as column matrices.
  • % stands for the last output in time (not necessarily the previous output in position in the worksheet). When a series of inputs using "%" goes bad and has to be re-edited and executed, you must re-execute from the first statement to which they refer to reset the sequence. %% stands for the next to last output in time.
  • Shift Enter. Holding the Shift key and pressing the Enter key at the end of a Maple input allows you to go to the next line.
    If you wish to put two Maple inputs together in 2d math notation, they must be separated by a semicolon ";"
    (or a colon ":" to suppress the output of the preceding command).
  • In 2d math mode input, spaces are needed between variables to imply multiplication:
    spaces
    between variables or between a variable and a constant (x y or 2 x or 3 I but not 2 2) imply multiplication but an asterisk "*" or centered dot from the Common Symbols palette is required in 1d mode and between hard numbers like 2 and 31/2 in 2d input as well as before parentheses: x (x+2) must have a space before the "(" or Maple will misbehave, xy will be interpreted as a new variable name, not as the product x y of two variables.
    The right arrow key is needed to climb down from a superscript and continue or climb up from a denominator (use / for division and fractions) and continue entering input. Always use parentheses ( ) when needed for grouping! All 4 arrow keys and the Tab key can be used to move around in 2d math input.
    To input underscore "_" in 2d math input, 1) hit the backslash key first "\" (suspend 2d interpreter) then the underscore key and it will insert the underscore character [you may also insert a slash "/"  for division in this way: \ / converts to / without forming a fraction in 2d mode] or 2) you need to show the punctuation palette by View Menu, Show Palette, Punctuation and then select underscore from the list in the Punctuation palette which appears at the end of the palette list: _C1 is needed to substitute for Maple introduced constants or "head_width" is needed for the plots[arrow] options, for example.
    [You will note that there are a few extra palettes not shown by default.]
  • When you give a range of values for a variable: x = 1..4, but when decimals are entered do x = 0.1..0.4 since Maple assumes 3 consecutive dots were intended to be 2 and the x = .1...4 is the same as x = 0.1..4 .

HELP!

  • F1 gives you the short list of keystroke hints.
         [The long list is under Help, Table of Contents, Advanced Features, Worksheet Interface, Windows. Like Control +4 for zoom 4 times.]
    Control F2
    gives you the Quick Reference Card summary of Maple interface help.
    When you put the cursor on a Maple command,
    F2
    gives you the Maple help for that command, or you can then go to the Help menu and find "Help on ..." listed to release the mouse on to achieve the same result.
    When a command is in a package like plots, or Student[Calculus1], by loading the package with no punctuation or a semicolon first, one can click on the desired command in the list and hit F2. Then you can suppress the list by inserting a colon after the input line as in  "> with(plots): ".
  • Control Space invokes auto-complete when entering Maple commands to choose from a popup menu of all commands which begin with the typed letters. This is really useful for "ReducedRowEchelonForm" and "BackwardsSubstitute" from the LinearAlgebra package.
  • If the output of a worksheet on the web has been removed (Edit Menu, bottom, Remove Output, from entire worksheet), it can be restored by Edit Menu, Execute Worksheet or by clicking on the !!! icon on the upper tool bar. You may also select a region and execute it with the ! icon.
  • After deleting a range of Maple stuff, you must use the Edit Menu, Delete Element to get rid of the last input/output/text region of the selected stuff.

2d plotting: multiple function graphs versus parametrized curves

  • Square brackets around a list of expressions maintains their order, while curly "set" braces do not, since sets are not supposed to have a preferred order.
    > plot([x2,x3], x=0..1)    will plot two power functions,
    > plot([x2,x3, x=0..1])    will plot the second expression versus the first as a parametrized curve, equivalent to graphing the function y = x3/2. [Note you need the surd command to plot odd fractional roots for negative inputs.]
    Alternatively just entering
    > [t2,t3]
    allows you to right click and choose plot builder and parametric plot.
     
  • If you enter an expression for a real function that you want to plot (or a sequence of functions separated by commas and surrounded by curly set braces), choose plot builder from the right click menu, not 2d plots (where you have to further right click on the smartplot and choose axes, range to reset the window). If you click on an equation say y = f(x) you must right click and first choose right hand side to get the expression to then plot with plot builder.
  • To 2d plot multiple expressions by right-click menu, one can also enter one expression and plot it by right-clicking on the output and selecting plot builder, then enter the other expressions in a new input region and select and drag them one by one from their output onto the plot. Avoid smartplot, it is not smart enough.

2d plotting: new features

There are a few new features that are useful to know for plots. First click on a plot to make it "live" (you see the resize box border). Then:

  • Right click on the plot and choose "Probe Info, Cursor Position" from the context menu to get two crosshair lines centered on the cursor in the plot with a numerical readout of the cursor position.
  • Click on the black grid icon on the plot context toolbar line that appears when the plot is live to get gridlines on the plot, very helpful for understanding how points on curves relate to the axis tickmarks. [Or use the plot option "gridlines = true" when using the plot command.]

Matrices or Vectors (1 row or 1 column):

  • Matrices and Vectors can be entered with the Matrix palette in 2d math input mode. A superscript of -1 will produce the inverse of a square matrix, while a space " " between matrices will multiply them, without loading the LinearAlgebra or Student[LinearAlgebra] packages. Matrices and Vectors can also be directly entered using < > to enclose a row or list of rows, commas to separate entries in a Vector or separate entries vertically in a column and " | " the vertical symbol to separate entries horizontally in a row. To "augment" a set of Vectors into a matrix, use Matrix([u1,u2]). Vectors are treated by default as column matrices and are shown as column matrices in Maple output.

    To retain this column matrix output when using the Student[VectorCalculus] package, you need an extra command:
    > with(Student[VectorCalculus]): BasisFormat(false)
    Without it a basis vector notation a1ex +a2ey +a3ez is the default for Maple output.

    Note: <<1|2|3>,<4|5|6>> and <<1,4>|<2,5>|<3,6>> are the same 2x3 matrix, first input as 2 rows, then as 3 columns.

    The LinearAlgebra or Student[Linearalgebra] package should be loaded: > with(LinearAlgebra):
    when doing anything more than right click menu operations on matrices. Transpose then converts between row and column matrices.
  • Right-clicking on a matrix and selecting Standard Operations allows the determinant to be evaluated. Selecting Eigenvalues, etc allows one to get the eigenvalues and eigenvectors, or the preliminary characteristic polynomial. Reduced row echelon form is also a right click away.
     
  • evalf (evaluate to floating point number) can be applied to a single expression, to a Vector or Matrix of expressions, or to a list of expressions [..., ..., ...], but not to a sequence of expressions ... , ... , ... (no delimiters); evalf(...,5) will limit the evaluation to 5 significant figures, so if it matters in the internal evaluation procedures, do   evalf(...):  evalf(...,5) so that the 10 digit final number is then rounded off to 5 significant figures, for example. Alternately just right clicking on an expression allows you to approximate it to various numbers of decimal places.
     
  • [Advanced: To add a row or column to an existing matrix in input mode: Control Shift R (for Row) or Control Shift C (for Column). The former also works to add lines to the Expression palette piecewise template: another row for each extra condition.

Prime derivative notation and Maple function notation:

  • Standard function notation holds once a Maple function arrow function is defined: f:= tt4 , then f ''(t) is the second derivative, f (4)(t) is the 4th derivative, etc. For partial derivatives the D[1,2](f) notation is preferable for Maple functions.
  • Using unapply instead of the arrow Maple function definition:
    Although in most cases the arrow definition available in the Expression palette is sufficient, one must occasionally use an alternative approach:
    > f := t→ t2; g := t → f '(t)/t; g(1)      here g(1) does not work since first t = 1 is substituted, after which the derivative does not work
    > f := t→ t2; g := unapply(f '(t)/t,t); g(1);  here t = 1 is substituted at the end of the procedure and it works
    One "unapplies" the formula to the variable to create a function independent of the dummy variable used in the formula.

    Alternatively, unapply fully evaluates an expression by substituting the values of all variables at the moment it is executed, while the arrow definition leaves the variables unevaluated until the function is called. See this example:
    > p:=2:  f := x → xp; f(x); p:=3; f(x)  [change: f(x) = x3]
    > p:=2:  f := unapply(xp,x); f(x); p:=3; f(x)  [no change, f(x) = x2]
    The arrow definition is convenient if you wish to update the value of a parameter in the Maple function after its definition. unapply is convenient if you want to finalize a function at its present form for present values of all parameters etc that may be present.
     
  • The default differentiation variable x for prime notation in 2d input can be changed by the View Menu, Typesetting Rules selection, lower left Differential Options section, prime derivative variable (change from x to t, for example): the default is that y' stands for dy/dx, but when t is the independent variable (time) it is often convenient to change the default, which can be done by the command:
    > Typesetting:-Settings(prime = t):
  • For stating differential equations using prime notation, the default differentiation variable is assumed. Input a list of differential equations and initial conditions separated by commans,  and right-clicking on the output allows Solve DE Interactively to bring up an applet, where one can choose Solve Symbolically, then Solve, then Quit
    >  x1''=x2, x2''=x1,x1(0)=1,x1'(0)=0,x2(0)=0,x2'(0)=1
  • If you want a different default differentiation variable without being bothered to change it, simply use explicit function notation with the desired variable:
    >   x1''(t)=x2(t), x2''(t)=x1(t),x1(0)=1,x1'(0)=0,x2(0)=0,x2'(0)=1
  • Don't waste time using subscripted variables like x1 with prime notation, just call it x1 unless you like being elegant.

Advanced Users Only

  • Want to include text or math formulas in your plots? It is easy with Maple's plot Drawing tools. See the example file.
  • Want to include plots with sliders to change the parameters in a family of functions?
    See the example file.
  • You can show the code; for example, to see the code for "plot" do:
    > interface(verboseproc=2);
    > readlib(plot);
    To read code of a command in a package use something like:
    > readlib(linalg:-charpoly);
  • To update an older Classic .mws worksheet with 1d math inputs, open it in Standard Maple and save it as a Standard worksheet, then go to Format, Styles, C 2d input, Modify, Restore to Default, OK, OK. Then you can select each range of only 1d inputs (avoiding text regions) and do Format, Convert to, 2d math input. This requires some fiddling, since the autolinebreaking feature is not perfect and there are a few other possible minor glitches. Remove final semicolons from a single input or from the final input of a multiple input line execution group; they are now only needed to separate multiple inputs.
  • To put a figure and text side by side in a document block region, just insert a 2x1 Table from the Insert Menu [turn off the exterior and interior borders in Properties] and copy and paste your plot into one of the two table cells, and type your text into the other cell. In a worksheet, you must first introduce a document block with the Format Menu, Create Document Block. Center the figure with the text center icon.
  • View Menu, Palettes, Arrange Palettes lets you put the most used palettes first: Expressions, Common Symbols, Matrix, Greek, Operators (for cross product symbol), Punctuation (for underscore in 2d math input).
  • To extract contents of the various tutors [Tools Menu, Tutors] which are not inserted as the final output of the applets into the worksheet, one must select contents of internal applet windows with the mouse, and then Control C copy and then paste into the worksheet after exiting the applet.
  • You can convert a document block to a worksheet block to reveal the underlying Maple commands which generated it. Select View menu, Show Markers to show a left strip marking off the individual document blocks, the right clicking on the marker for a given block allows it to be expanded, and then collapsed.

Please share your tips by emailing robert.jantzen@villanova.edu.

Learn to use Maple

by seeing short live videos at Maplesoft training videos or You Tube! Get more help from the Maple Student Help Center. Start by doing the Maple Help Menu 10 Minute Tour and its follow up on numerical and symbolic computations.

file

Maple Student Help Center

For some of you, the Maple Student Help Center might prove useful. It offers on-line help: "Get real answers from real people" "within hours" for homework problems by posting your questions on the on-line Forum. Free registration at Maple Primes is required for access.

* citrix-mac-users-1.pdf
Mac User Guide

Teaching Concepts with Maple

Learn how to do specific tasks with Maple in all levels of Calculus and Differential Equations and Linear Algebra with Clickable Calculus:

Maple Teaching Site