Homework 1, due Sept 14
Homework may be given to the TA in class or left under his office
door after class any time the evening of the due date.
Do not leave homework in the lobby mailboxes.
Make sure that pages are stapled together and your
name is written clearly. Paperclips can be used as a last resort,
but loose pages will not be graded. Do not submit homework by email.
Late homework is due promptly at the
start of the class a week later, as I will comment on each
homework during the subsequent lecture. Late homework is penalized 20%.
Please note the following required format
which will apply to future homeworks as well. Submit:
- a listing of the requested function(s),
including comments explaining the purpose of the
function and the input and output arguments (parameters).
Each function should compute and return result(s),
but should not produce printed or plotted output.
Printing or plotting should be done after calling the function.
Do not submit listings of the session or main program that does this.
- printed output in the form of a graphics plot or
table of numbers as appropriate (not both). Do not
submit any more printed output than is necessary to answer the questions.
An excessive amount of output will result in a reduced grade.
- hand-written or typed remarks about the output,
either on the same page or a different page.
- Exercise 1.7, p.45 of the text.
If you use Matlab, you can use loglog to generate the plot.
For part (b), comment on whether the best value for h is
bigger or smaller than in part (a), and why.
- Exercise 1.12, p.46-47 of the text.
If you use C, it is best to
write two different functions for the two formulas.
In Matlab, you can do the same or, since multiple outputs are available,
you can combine them in one function and use a second
input argument to select which formula to use.
For part (a), randomly generated input is fine; if both
formulas do not produce nearly the same answer, there is probably a
bug. For part (b), if you find input that illustrates the difference
between the formulas, also explain why this is the case.
You are expected to do homeworks by yourself if possible, but if you
need help, from the TA or another student, this is allowed as long
as you specifically acknowledge it on your submission, either
in the program comments or in an additional note. Doing so will not
reduce your grade, but failing to do so may mean that you will receive
0 for the assignment.