You are given a program and Makefile that implements differentiation by forward differencing for the function
sin(x2).
The executable is invoked with command line arguments for the function parameter value, the starting h value and the number of iterations to perform.
Each iteration computes an estimate for the derivative at the value using the current value of h, and then divides h by 10 for the next iteration.
As examples, and as part of the assignment, run the Forward Differencing Method (using 'floats') with the following arguments:
forward 1.0 0.1 10
central 1.0 0.1 10
Richardson 1.0 0.1 10
You are to implement the Central Differencing Method and Richardson Extrapolation (just one level of divided differences).
- Run these 3 methods using both 'floats' and 'doubles'.
Use the results to estimate the best 'h' value for these 6 methods (3 techniques x 2 floating point representations).
- Rerun these methods at value = 2.0 and again use both 'floats' and 'double'.
Explain the results.
Use the 'verbose' mode when appropriate to understand the results.
Specifically, what do the results tell you about:
- the benefit in using smaller values of h in order to get a better approximation to the derivative of a function.
At what value of h does the numerator value become totally round-off error?
- the benefit in using an approximation method with a better error term in order to get a better approximation to the derivative of a function.
- The tradeoff in using 'double' instead of 'float'.