Question: Problem 1. Finite difference approximations. Recall that forward and centered finite-difference approximations for the derivative of a function f are given by ?(1)f(x) = f(x+h)?f(x),
Problem 1. Finite difference approximations.
Recall that forward and centered finite-difference approximations for the derivative of a function f are given by ?(1)f(x) = f(x+h)?f(x), ?(0)f(x) = f(x+h)?f(x?h).
h h h 2h
(a) Other useful finite-difference approximations can be constructed in similar ways. Show that
?hf(x) = 1 ?2f(x+h)+3f(x)?6f(x?h)+f(x?2h)?, 6h
approximates f?(x) up to an error term of order O(h3).
(b) Define the finite-difference approximation errors:
e(1)(x) = f?(x) ? ?(1)f(x), hh
e(0)(x) = f?(x) ? ?(0)f(x), hh
eh(x) = f?(x) ? ?hf(x). For the function f(x) = sin(x) and x0 = 1, plot the above errors as a function of h on a log-log scale. That is,
plot log |e(1)(x0)|, log |e(0)(x0)| and log |eh(x0)| as a function of log h. hh
(c) What are the slopes in your three graphs? Are they in line with what we should expect from theoretical results?

Problem 1. Finite difference approximations. Recall that forward and centered finite-difference approximations for the derivative of a function f are given by A ," f ( x ) = f(Ith) - f(I) 4," f ( z ) = f( x th) - f(I - h) h 2h (a) Other useful finite-difference approximations can be constructed in similar ways. Show that Anf (x) = (2f(r + h) +3f(x) -6f(x - h) + f(x - 2h)), approximates f' (x) up to an error term of order O(h3). (b) Define the finite-difference approximation errors: e(") (I) = f'(x) - Aff(x), (@ (x) = f'(1) - , f(I), en(I) = f'(x) - Anf(x). For the function f(x) = sin(x) and To = 1, plot the above errors as a function of h on a log-log scale. That is, plot log len (ro)|, log len (ro)| and log Jen (To) | as a function of log h. (c) What are the slopes in your three graphs? Are they in line with what we should expect from theoretical results
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
