Question: Consider the function f(x)=sin(x) defined over the interval [0,2]. a) How small do you have to make the distance h between xo and its
Consider the function f(x)=sin(x) defined over the interval [0,2]. a) How small do you have to make the distance h between xo and its neighboring points to compute the first derivative f(x=xo) at x=/4 with an O(h) forward finite difference formula and a relative error of 10-6? Start with a value of h=0.2 and progressively reduce it by a factor of 10 each time until you fall below the desired error threshold. Plot on a log-log diagram the relative error as a function of distance h. b) In a similar spirit to what we discussed in class, for the above choice of finite difference formula, the truncation error is bounded by Mh/2 where M = max {\"()|} and } is a point in the neighborhood of xo The round-off error is bounded by 2/h where & is the machine epsilon. If you are working with a computer that is limited to single-precision do you expect the same level of accuracy from the numerical differentiation in part (a) of this problem (even with the sufficiently small h you have identified)? Explain your answer without explicitly repeating the computations of part (a) in single-precision.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
