Description
1. Implement the following numerical methods for approximating first derivatives: (i) one-sided
forward difference, (ii) one-sided backward difference, and (iii) central difference. Consider the
function
f(x) = sin(4.8 π x).
Use the numerical methods to estimate the derivative at x = 0.2 using the following values for h:
h = 2−k
, k = 5, 6, . . . , 24.
Plot the error versus h on a log-log scale. (You can compute the derivative by hand to get the
truth.) For each of the three methods, what is the rate of convergence you observe?
2. Consider the finite difference approximation
f
0
(x) ≈
1
6h
[2f(x + h) + 3f(x) − 6f(x − h) + f(x − 2h)] .
Using a numerical study similar to Problem 1, identify the rate of convergence for this approximation. Produce a plot that justifies your computed rate. Identify the asymptotic regime in your
plot.
BONUS: Construct and implement a 4th-order finite difference approximation of a first derivative.
1. (50 points) Use a Taylor series argument to prove that your method is 4th order.
2. (50 points) Run a numerical experiment to demonstrate that your method is 4th order.
1