Question: Write a C++ program that calculates the derivative using three methods (the forward derivative, backward derivative, and the centered derivative) of a function that is
Write a C++ program that calculates the derivative using three methods (the forward derivative, backward derivative, and the centered derivative) of a function that is defined separately from the main() part of the code. Have the user specify the value of , but print out the results for different step sizes: 01, 0.01, 0.001, and 0.0001 Use this code to calculate the derivatives of ( and sinh r for three values of 0.0,1.5, and 10.0. Use the smallest step size of the centered derivative to define the "correct" value (this is assuming no round-off error, of course), and determine the percent accuracy of each method/step size. Note: do not compare your result to the analytic result
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
