Starting from:

$25

MATH3315 -Project 1_Errors in Scientific Computing - Solved

This project studies numerical errors, which are composed of two parts: the roundoff errors and the truncation errors. We will first work on the truncation errors by numerically approximating the second derivative of a given function at a point with two methods of different accuracy as in a) and b). Following that, in c) we will keep on reducing the truncation error (using smaller and smaller h) until roundoff error in Matlab starts to dominate the truncation error.

a)   Recall that given function f(x), the second order derivative of f(x), f00(x) can be approxh   h

imated by the forward difference approximation,.

Let f(x) be a function of your pick (do not use f(x) = ex), and compute f00(x) numerically at x = a of your pick with h = 0.1,0.05,0.025,0.0125,0.00625,0.003125. Present a table with the following format. column 1: h, column 2:  ), column 3:  ), column 4: (f00(a) − D+f2(a))/h, column 5: ( . column 6: order. Output your table in a professional way by formatting the tabular data appropriately.

b)  Repeat for the centered difference approximation, , which also approximates f00(x).

c)   Modify the Matlab code given in class to plot the error in ) and  ) for step size h = 1/2j with j = 0 : 64. Use log scales for the error |f00(a) − D2f(a)| and step size h. Plot both cases on the same graph in a professional way. (hint: use “hold on” command).

More products