Log on
Apply | Contact Us | Give a Gift | VU Home | Site Index | Text only
MAPLE Examples and Tips

Learn to use Maple by seeing short live videos at Maplesoft training videos. 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.

Maple worksheets on the web?
When you are using Citrix Maple especially, 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:

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

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 between variables or between a variable and a constant (x y or 2 x or 3 I but not 2 2) imply multiplication (an asterisk "*" is required in 1d mode and between hard numbers like 2 and 31/2 in 2d input) and 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.
    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.

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 rows or lists 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.
    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.
     
  • 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.

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. Surrounding one or more differential equations and initial conditions by set curly braces to make a set of equations and right-clicking on the output allows Solve DE Interactively to bring up an applet, where one can choose Solve Symbolically, then Solve
    > { 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.

Advanced Users Only

  • You can show the code
  • for Maple procedures in two different ways with slightly different formatting:
    > showstat(int)
    or
    > interface(verboseproc=2); eval(int).
  • 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.
  • 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.

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