# CS 770 Assignment #1  solution

1. (a) Consider an approximation of the ﬁrst derivative of f(x)
df dx ≈
f(x + h)−f(x) h
.
The error in this appximation is e(x)
e(x,h) =
f(x + h)−f(x) h −f0(x). (1)
Using the Taylor series expansion of f(x + h) about x, obtain
e(x,h) =
h 2
d2f dx2
(x + ξ).
Plot e(x,h) in (1) on the log-log scale for h ranging from 0.1 to 10−20 for the function of your choosing at a point x of your choosing. In an exact arithmetic we would expect e(x,h) to linearly decay with h. However with the ﬂoating point computer arithmetic you will ﬁnd that the error begins to increase starting at some h. Explain this phenomenon and give a rough estimate (the order of magnitude is suﬃcient) for this turning point. (b) Repeat the part above for
d2f dx2 ≈
f(x + h)−2f(x) + f(x−h) h2
2. Give your own examples that would illustrate inexactness of algebraic operations, noncommutativeness of algebraic operations, and cancellation errors in IEEE ﬂoating point arithmetics (see Moler p.40 for an example). Include a print-out of your Matlab session or your code.
3. Exercise 1.38 in Moler
4. Exercises 3.1 - 3.6 in Overton