Introduction to Maple Versions 7 to 16

Authors and Credits
Angie Gardiner compiled the documents using these resources:
Multivariate Mathematics with Maple by James A. Carlson and Jennifer M. Johnson, copyright 1996
Introduction to Maple V.4 in the Undergraduate Computer Lab by James A. Carlson and Jennifer M. Johnson, 1993
Added in 2008: Math 2250 Maple Tutorial by Nick Korevaar
Added in 2012: Math 2250, 2270, 2280 Maple Tutorial by Grant Gustafson

What is Maple?

 Maple is a software package called a computer algebra system. It
 does symbolic computations, such as derivatives and integrals. In
 addition, it is a numerical laboratory, suited for numerical
 computation, simulations, and what-if experiments in science and
 engineering.

 The graphics features of Maple are useful for geometrical visualization
 of ideas, understanding definitions and exploring techniques. Use the
 graphical interface to develop your intuition while learning new
 topics. 
 
 The Math Center Lab 
 Before you start learning Maple, it is helpful to familiarize yourself
 with the facilities in the computer lab in the T. Benny Rushing
 Mathematics Student Center. Please ask in the Math Center for a printed
 copy of the document Introduction to the Computer Lab.
 
 Campus Access to Maple
 Campus departments with computer facilities have installed maple under
 a campus-wide site license. It may be convenient to do xmaple sessions
 in your own department, or 24/7 from home with maple, a non-graphical
 interface running in an xterm window. 

Starting Maple

  Unix Terminal Instructions. 
  If using a UNIX station in the Math Center, which by default runs
  X-windows, then click on the maple leaf icon at the bottom of the
  screen. Then select X Maple V12, or X Maple V16. Soon a new window
  will appear.  Click the window top and hold the mouse, then move the
  window. When satisfied with the screen position, then release the
  mouse button.

  Alternative launch. First launch application xterm, then type
  command xmaple &. The xterm command can be found on the
  middle mouse button menu; click the wallpaper to get a menu.

  MacLab Instructions. 
  If you are using a Mac in the Math Center, then click on the icon at
  the upper right corner of your screen labeled /. This will open a new
  window. Click on the Applications button in this window, and then
  select XDarwin from the applications and run it rootless.  After a
  couple of minutes, you will get a terminal window. In this window,
  type ssh xserver. After login, type xmaple at the prompt
  to start Maple. Icons in the upper right corner of the maple window
  allow resize. 

Exiting Maple

 It is routine to exit maple after the session ends. 
 
 The command to exit is on the FILE menu, a mouse operation. Reasons to
 exit include a non-responding maple engine, which everyone eventually
 encounters.
 
 A dialog box appears on exit, asking if you want to save the file(s).
 Answering NO is usual if you are just learning maple and don't have any
 valuable work. Answering YES will cause another dialog box to appear,
 asking for a file name to save the worksheet. More than one dialog box
 appears, if there are multiple worksheets.

 In order to not lose valuable work, it is advisable to save the file
 periodically, especially after typing for many minutes.

 Saving a file 
 To save a Maple session that you have been working on and give it a
 name, choose FILE ==> SAVE AS from the top of the screen. The SAVE AS
 dialog box will appear. To save the worksheet as a file with name
 hwk1, fill in the dialog box. If the box contains text *.mws
 or *.mw, then delete the asterisk (*) and type the file name. Then
 hit the Return (Macs) or Enter (UNIX) key, or click on OK.
 
 Keep file names simple, using only letters and numbers, without any
 special symbols. In particular, avoid using spaces or periods.  Maple
 will add the .mws or .mw extension to identify the saved file as a
 Maple worksheet.  
 
 Once a file has been saved, the menu command File ==> Save, or the
 diskette icon (save icon) at the top of the window, can be used to
 re-write the contents. 
 
 AUTO-SAVE. A feature in maple, it creates every so many minutes 
 a backup copy of the current worksheet. A file saved as "foo.mw" has
 backup file "foo_MAS.bak" located in the same directory. When "foo.mw"
 is manually saved (e.g., ctrl-S or the FILE menu), then the backup is
 erased and not written again until the worksheet is changed. 
 
 Normally, you will not see the backup file, because on exit you are
 forced to save the file, which erases the backup. Set the backup
 frequency in TOOLS ==> OPTIONS ==> GENERAL. 
 
 No matter the dialog box option taken, the backup is removed. You lose
 what was typed, if not saved to a file. Especially, on a NEW WORKSHEET
 which has not been saved, no backup is made during typing!

 Crashed Maple Recovery 
 After a crash of maple, there is a file in the same directory with
 extension _MAS.BAK which contains all recent typing since the last
 save. Load the file that crashed and also this _MAS.BAK file with
 matching file name. Mouse-copy from the save-file into the crashed
 file, to get back what is possible.  Be selective, then use SAVE AS
 with a new file name, in case of another crash event.

Maple User Interface

 WORKSHEET and DOCUMENT modes
 The WORKSHEET MODE will be described. There is a window with two colors
 on the screen. RED is what you type on the keyboard, or paste into
 maple with the mouse. BLUE is what the maple engine prints in response
 to entered commands

 If the maple window does not have this appearance, then it could have
 started in DOCUMENT MODE. There is a way to change this default, best
 done with the help of a maple expert. Ask a maple instructor for
 details, because it depends on the maple version being used. Once
 changed to the RED-BLUE interface, then it will be used by default for
 every subsequent maple session.

 In either mode, the mouse positions the cursor, along with arrow keys.
 Usual editing keys like BACKSPACE, DELETE apply. But RETURN has a
 special meaning, namely to request the maple engine to execute the
 commands preceding up to the last left-side greater-than sign (>).
 
 Additional keys useful for editing in either interface:
   ctrl-z  Undo last edit
   ctrl-k  Insert line above the current line
   ctrl-J  Insert line below the current line
   ctrl-c  Copy mouse-highlighted text
   ctrl-v  Paste text that was previously copied

 Copy and Paste  
 Maple rookies can avoid typing errors by copying known valid code with
 the mouse (highlight, then ctrl-C ), followed by paste onto a new line
 (mouse click at target location, then ctrl-V).  Copy works from text
 documents and also PDF documents (copy requires adobe reader ). To
 paste, try the menu item PASTE. Then ctrl-V. Then RIGHT MOUSE BUTTON.
 Then MIDDLE MOUSE BUTTON . If none of that works, then hold down the
 SHIFT KEY and try the mouse buttons again.

    Mac Workstation. 
    If you are using a Mac, use the mouse to highlight the command(s)
    you want to copy, then choose Edit -> Copy from the menus.
       
    Move the cursor to where you want to paste the text , then choose
    Edit -> Paste.

    Unix Workstation.
    Press and hold down the left mouse button at the beginning of the
    text you want to copy.  Still holding the button down, drag the
    mouse until you have highlighted the desired text.  Release the
    mouse button.  Move the cursor to the position where you want to
    paste. Click the left mouse button to mark this spot.  Click the
    middle mouse button to paste.

 Repeat Paste
 Copied text stays in memory and anytime you press the middle mouse
 button (or choose Paste from the Edit menu) it will be pasted at the
 current cursor position.  This can cause surprises. An accidental hit
 the middle mouse button will paste, unexpectedly. An immediate ctrl-z
 will undo the error. For safety, mouse-copy some blank space to clear
 the copied text.

 Editing a Saved Maple file  
 It may take more than one session at the computer to complete your
 analysis. Save your work on disk, and come back to the lab and open
 your Maple file again to continue working.  Often it will be useful to
 take with you a printed copy of your Maple session so you can think
 about what you have done so far, and how you want to continue when you
 come back to the lab, or so that you can get help from a lab
 instructor, a friend, or the instructor.

 Deleting Text.  
 Besides the keyboard backspace and delete keys, you can also delete
 text or commands by using the mouse to highlight the area you want to
 delete, then hit the Delete key. To delete an entire computation or a
 plot, move the cursor into the command block (square left bracket on
 the left screen edge) that produced the computation or click on the
 plot. Hold down the Control key and press the Delete key. The Edit menu
 has a duplicate. Accelerate typing by learning key shortcuts from the
 menus.

 Comments
 In any command line, Maple ignores anything typed after the # symbol to
 the end of that line.

  Example:

    solve(3*x+2*y-5*z=0,z); # Solve for z in terms of 
                            # symbols x and y

 Block Comments
  To add comments between commands, click the mouse anywhere in the
  command block. Then click on the icon T at the top of the      
  screen (left of icon [>). A new text block appears one group below,
  then the cursor moves into the block. The pull-down menus and icons at
  the top of the Maple window allow choice of the font, font size,
  style, color and more. Default text is Times Roman black at 12 points.

  To exit the TEXT mode, find at the maple window top this line
                 Text Math Drawing Plot Animation
  and mouse-click the MATH icon. This undocumented requirement is able
  to frustrate Rookies, who somehow start typing in BLACK and cannot
  switch back to RED, the MATH mode.
  
 Using Maple and Getting Help
 The best way to learn Maple is by using it.  But first, a few remarks
 about Maple.  The symbol > ; is the command prompt, which Maple uses
 to signal you that it awaits your command.  Commands normally end with
 a semicolon (;) if you want to see the output or a colon (:) if you
 don't want to see the output.  Maple is a programming language. It has
 strict rules of punctuation, grammar, and spelling.  If something is
 not working right, check to see if you are following the rules.  For
 example, the Maple engine will get confused if you write 2x instead of
 2*x. Check for things like misspelled names or extra or missing
 parentheses.  If further thought doesn't clear things up, ask a human
 for help.  You will become an expert troubleshooter only by making
 mistakes and then correcting those mistakes.

 While learning Maple, you will have questions about how a particular
 command or function is used. To ask MAPLE about a command whose name
 you know, just type a question mark, followed by the name of the
 command.  For instance,

   ?solve

 gives information on the solve command.  Scroll forward to the examples
 at the end. Most questions are answered by the examples. If not
 answered, then use the technical information at the beginning of the
 help file.  For specific help on how to do something in maple, use a
 google search in a browser - it is faster than sorting through maple's
 help system.

 The help system in maple supports full text search or topic search of
 Maple's help files.  You will find these options under the Help menu in
 the upper right corner of the Maple window.  You will also find other
 handy things , such as Introduction, New User's Tour, and Using Help.
 Rookies are frustrated by the help system, but encouraged by google
 searches, which can answer a specific question.

Printing

  
 To print your Maple session directly from Maple, choose Print from the
 File menu (or click on the Printer icon). In the Printer Setup window
 that appears, check that Print Command is selected, rather than Output
 to File, and click Print.

 Alternatively, you can save your Maple session to a PDF file, then then
 print it from acroread (adobe reader). Choose File ==> Export and save
 the worksheet as a PDF file, like hwk1.pdf.
 
 To send a PDF file to the printer, load the file into adobe reader,
 then choose Print on the adobe reader (acroread) menu. The maple file
 types mws, mw can only be printed from xmaple. Don't use lpr on
 PDF files, because of printer filters that may silently change the
 print file contents. The same advice applies for the Math Dept command
 print, which is a locally produced shell file that uses lpr.
 
 Print to a File. The print dialog box may offer to print to a
 file. Some maple versions don't have the feature. Don't print to a
 file. Use the Export command to output the worksheet to PDF,
 which is a portable print format.

 The dialog box inside Maple for the printer may have a default print
 command (lpr). It may be changed to lpr -l or to lpr -
 oraw in order to solve printing problems. If your printout does not
 appear on the printer, then suspect an adulterated lpr command
 or incorrect destination printer in a dialog box. 

               **If you are having trouble printing, then
                please ask the lab assistant for help.**

Email a Worksheet

 If you are looking for a simple way to email your worksheet, then try
 the easiest solution: copy with the mouse and paste it into the email
 program. It is helpful to remove the output from the worksheet before
 mouse copy; see the EDIT menu. This method has the advantage of being
 version free: whoever gets the code can use it directly in whatever
 version of maple is on their computer.

Reloading a Saved Maple Session

 When you come back to work on a Maple file that you've already started,
 your task now is to reopen that file and get back to where you left
 off. To open a file, choose File ==> Open.  An Open File dialog box
 will appear. In this box you will see a list of Maple files. Click on
 the file that you want to open, then hit the Enter key or click OK.
 BROWSE for it, if not found. Advice: save your files in an easy to find
 location.

          It is not enough to just OPEN the saved file!

 Surprises when reloading a Maple File. Although Maple loads and
 displays a record of your last session, it unloads variables. One way
 to get Maple to reload variables from last time is to go to the
 beginning of your file and hit the Return key until you get to the last
 line of the file. (You might want to use the arrow keys to skip the
 lines that displayed plots or requests for help files). This will
 ensure that Maple's memory of your last session is restored. A shortcut
 for executing the entire worksheet is to click the icon !!! at
 the window top. Inserting a comment marker (#-sign) at the front of
 plot or help lines speeds the worksheet re-execute.
 
Next: Hand Calculator Examples.