Computational Homework Guidelines
Prof. Goodman
August 3, 2009
Many homework problems will ask you to write a computer program to implement a numerical method or solve a specific problem. Here are the rules you must follow:
Programming Language
You may use any language you want but it must be a programming language. Microsoft Excel is not a programming language, although Visual Basic is. Some good choices are Matlab, FORTRAN, C, C++, Java, or Python. If you want to be able to ask for my help in writing programs, you’ll have to use Matlab or FORTRAN.
As your professor, let me recommend that you use Matlab. It has the following features that make it ideal for learning numerical methods.
-
Both command-line and programming language capabilities. Anything that you can do at the command line, you may use as part of a program, and vice versa. This makes it easy to try things out before you commit them to a program.
-
Integrated graphing: It is very simple to generate professional-quality graphs from within your Matlab programming. Even more impressive is the ”publish” feature in Matlab’s editor, which allows you to integrate code, writeup, and graphs all into an HTML report.
-
Vectorized programming. See some of the example programs I have provided to see what this means.
-
Good help built in, plus your professor is quite good with this language.
You can download a copy of Matlab from the NJIT software downloads page. A good but not perfect free replacement is called Octave.
Assignments
Follow the guidelines below. Failing to follow the guidelines will cause you to lose points.
Each programming assignment should contain three components:
-
Code.
-
Outputs. Essentially, these are lists of numbers, but beware: Raw lists of numbers are unacceptable! Your data should be presented as either:
-
A short report.
A little more detail.
1 Code
You may write in whatever language you choose. Each problem should contain a complete listing of the code used to solve the problem, including any subroutines. Comments should be used to make the code readable. This listing is very important so that your experiment is reproducible and so that you know exactly what you did (and not just what you thought you did).
2 Outputs
-
Tables and plots must have appropriate titles and labels.
-
Numbers presented in tables should be carefully formatted and aligned.
-
Attention should be given to the appropriate number of significant figures to be reported.
-
Legends should be used when needed.
-
Concise explanative text should be furnished for tables and plots when needed.
-
Data selected for presentation should be carefully chosen.
-
Lines and markers indicating and connecting data points must be carefully chosen.
-
Try to put as many tables as possible together and as many plots as possible on one graph (within reason). It is much easier to look at things that are next to each other, than to flip from page to page.
-
Graphs and tables can be generated directly from your programs, or you can make them by hand, with a word processor, or some combination. Whatever the case, they must be formatted as described.
3 Report
It is never enough simply to show your results—there must be some explanation of what the numbers, and their associated errors, mean. For example:
-
Do the numerical results agree with known results?
-
Are the errors “reasonable” and to the correct order (if known)?
-
Are there any unusual features which should be mentioned and/or explained?
It is very important that you “talk” the reader through this part, because otherwise it may just be a jumble of unintelligible numbers and/or graphs.