Next: About this document ...
ESC 251 HW 21 Due: Oct. 27
- (6 pts) For this problem, you will compare 2 methods for
approximating the derivative of a function. Using the code in the notes
as a guide, generate a table of values of f(x) for In
addition, at each x-coordinate, generate approximations for f'(x)
using the formulas:
Compute the relative errors in your approximations Note that you will have
a relative error for each point in the table and some of the relative
errors will need special attention.
Test your program using
on the interval
Use n = 10 and
Which derivative approximation is
more accurate? If you try to print out x, f(x), both approximations
for f'(x) and their relative errors on one line, your output will wrap
at the screen boundary so you may need to experiment with your data
- What happens to your errors in Problem 1 if you try and use
10-11 = 1.0d-11 Why does this happen?