Docsity

CMSC/AMSC 460 Fall 2007 Homework - Fixing & Expanding 'elephant.m' Program, Assignments of Mathematics

Toggle sidebar
bg1
CMSC/AMSC 460 Fall 2007
Homework 2
Due Tuesday, October 2, before class begins
10 points
(1) (5) The program elephant.m fails when the x-coordinates of the
points are not in order. Fix it so that it works properly in this case. (Hint:
Matlab’s sort function will be useful.)
(2) (5) Add a fourth algorithm to elephant.m so that it also fits a Hermite
cubic to the data.
For full credit: Hand in
•a listing of your well-documented program.
•a copy of Figure 2 for three different sets of interpolating points, where
at least one of the 12 pictures gives a good approximation to the ele-
phant.
If you hand in hardcopy, keep your program in case the TA tells you later
that she wants to test it.
The documentation at the top of the function should provide basic infor-
mation to help a potential user decide whether the software is of interest. It
should include:
•purpose of code, since this is certainly the first thing a user wants to
know!
•name of author, since it provides someone to whom bugs can be re-
ported and questions asked.
•date of the original code and a list of later modifications, since it gives
information such as whether the code is likely to run under the cur-
rent computer environment and whether it might include the latest
advances.
1
pf2

Partial preview of the text

Download CMSC/AMSC 460 Fall 2007 Homework - Fixing & Expanding 'elephant.m' Program and more Assignments Mathematics in PDF only on Docsity!

CMSC/AMSC 460 Fall 2007 Homework 2 Due Tuesday, October 2, before class begins 10 points

(1) (5) The program elephant.m fails when the x-coordinates of the points are not in order. Fix it so that it works properly in this case. (Hint: Matlab’s sort function will be useful.)

(2) (5) Add a fourth algorithm to elephant.m so that it also fits a Hermite cubic to the data.

For full credit: Hand in

  • a listing of your well-documented program.
  • a copy of Figure 2 for three different sets of interpolating points, where at least one of the 12 pictures gives a good approximation to the ele- phant.

If you hand in hardcopy, keep your program in case the TA tells you later that she wants to test it.

The documentation at the top of the function should provide basic infor- mation to help a potential user decide whether the software is of interest. It should include:

  • purpose of code, since this is certainly the first thing a user wants to know!
  • name of author, since it provides someone to whom bugs can be re- ported and questions asked.
  • date of the original code and a list of later modifications, since it gives information such as whether the code is likely to run under the cur- rent computer environment and whether it might include the latest advances.
  • description of each input parameter, if any, so that a user knows what information needs to be provided and in what format.
  • description of each output parameter, so that a user knows what infor- mation is produced.
  • brief description of the method and references, to help a user decide whether the method fits his/her needs.

In-line documentation identifies the major sections of the code and pro- vides some detail on the method used. It is important in specifying the al- gorithm, identifying bugs, and providing information to someone who might need to modify the software in order to solve a slightly different problem. Note that the documentation should be an integral part of the code; in other words, it is not enough to include it in a separate document, because a potential user might not have access to that document.