
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Homework # Due (in class) Thursday 07/22/
Computer Assignment: Do the exercises outline below for at least three of the following functions: 1 /x, log(x), ex, tan(x), cosh(x) , sin(x), x^3 − 23 x.
Let
φh 1 (x) = f (x + h) − f (x) h
, φh 2 (x) = f (x + h) − f (x − h) 2 h
, φh 2 (x) = 4 f (x + h) − 3 f (x) − f (x + 2h) 2 h
1)Select an appropriate point x and compute φhi (x) for the functions f above with h = 1, 1 / 2 , 1 / 4 , 1 / 8 , / 16 , etc. 2)Compare the approximations that you have obtained with the exact value of the derivative and plot your results for different h. 3)For φ 1 and φ 2 determine what portion of the error is due to round-off by using the estimate for the truncation error derived in class. (it’s also in the text) 4)For φ 3 determine the order of the method by performing the following numerical experiment:
Assume that f ′(x) = φh 3 (x) + C ∗ hp. Use the result of your first run to
determine A 1 = φ^13 (x), A 2 = φ^13 / 2 (x), A 3 = φ^1 /^2
3 3 (x), etc. Notice that Ai+1 − Ai = Chp(1/ 2 p^ − 1). Since p and C are both fixed, you can try to estimate C(1/ 2 p^ − 1) by looking at Ai+1 hα− Aifor different values of α. If α < p, this ratio should be going to 0, as h → 0. If α > p, it should be blowing up. And only for α = p you should be getting a constant non-zero limit. Of course if h becomes too small, roundoff will kick in. Knowing that the machine ≈ 1 / 252 , you should be able to gauge how small can h become before you start getting nonsensical results. Plot your results and carefully label them. 5)Try to think of a way to decrease the error if you have A 1 and A 2 computed, i.e. how can you combine the two to get something which has a smaller error.