M-H: Maple Homework Formatting

This page describes our requirements and suggestions for handing in homework in Maple. The requirements are the following:

  • Your document must contain
    1. your name and login/watiam name at the top,
    2. followed by a “short answer” section where you give just the final answer for all questions,
    3. followed by a section for each problem where you show your full work.
  • You should submit exactly one .mw file, with all of the exercises combined.
  • Your “full work” must be reproducible. That is to say if we open your file and re-run all of the program from scratch (using the !!! button or Edit > Execute > Worksheet) then no errors should occur, and we should see how you arrived at each answer.
    • As a special case of “no errors,” put any text in comments (#).
    • Full work does not require that we see every line you ever typed in Maple. Delete anything that didn’t help get to the final answer (it’s okay if you leave a few extra lines to illustrate your thought/work process, but don’t let this be too long).
    • In particular, delete any sample lines from the lesson material that is not relevant to the homework problems. Or, keep two files on your computer, one for homework and one for running lesson examples.
  • Your homework should not be difficult to read. In particular, if Maple produces any very long calculations (say more than 5 lines of output) then punctuate the command with : instead of ; in order to suppress the output.
  • Try not to let your lines of input get crazily long either.
  • Use comments to clarify your code wherever you think it helps make your code easier to understand. However, don’t go overboard; commenting every single line does not make your code easier to understand. In general, though, we do not grade your commenting style.

In order to build a document like this, you’ll probably find the following helpful.

  • the restart command from Lesson M-2 is a good thing to put at the top of your document
  • use Ctrl-J and Ctrl-K to insert new > lines below or above your current position (they are called “execution groups”)
  • use Ctrl-Alt-Shift-E followed by Backspace to delete a > line. You can also select a region with Shift or by dragging the cursor
  • be ready to use undo (Ctrl-Z) in case you delete too much!
  • use Cut (Ctrl-X) and Paste (Ctrl-V) (or Copy (Ctrl-C) and Paste) to make life easier
  • on a Mac: replace Ctrl above by Command and Alt by Option

We’d prefer if you avoided any of the extra fancy document formatting features of Maple (different fonts, input styles, and sectioning dividers) for this assignment.


Consider the following hypothetical problem set of 3 questions:

  • factorial: how many digits does 100! have?
  • quadratic: define a function qroot(a, b, c) to compute the largest root of \(ax^2+bx+c=0\) assuming \(a>0\). Don’t worry if it gives imaginary values when the discriminant is negative. What is qroot(105, -268, -253)?
  • coefften: what is the coefficient of \(x^{10}\) in \((1+x+x^2)^{10}\)?

We’ve put together an example file of what a reasonable set of solutions would look like.

These are course notes for the University of Waterloo's course Math 600: Mathematical Software.
© 2012—. Written and developed by David Pritchard and Stephen Tosh. Contact (goes to the CEMC)