Question: (CS417/517) Machine Assignment 3 1 (8 points) Approximating the Derivative Write a program to compute an approximate value for the derivative of f(x) using the

(CS417/517) Machine Assignment 3 1 (8 points) Approximating the Derivative Write a program to compute an approximate value for the derivative of f(x) using the finite difference formula f(x)hf(x+h)f(x). Test your program using the function sin(x) for x=1. The variable x will remain fixed at 1 (i.e., set x=1 ). Determine the error by comparing your computed value with the built-in function cos(x). Loop over h=21,41,81,2301 Your output should be similar to However, unlike this abbreviated example you must complete up to 230. Take the output of your program and plot h (x-axis) vs absolute error ( y-axis). Set both axes (x-axis and y-axis) to logarithmic scales. Is there a minimum value for the magnitude of the error? If such a value exists, how does it compare to eps (Use the Cleve Moler Algorithm to approximate eps.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
