The forward-difference approximation to is

PHYSICS · Subjective · Fermi University Physics · Mathematical Methods for Physics · Computational Physics · Scientific programming for physicists

Computational Physics, Ch Letting the computer do the algebra

Problem

The forward-difference approximation to f′(x)f'(x) is Dhf(x)=f(x+h)−f(x)hD_h f(x) = \dfrac{f(x+h)-f(x)}{h}. Take f(x)=e−xf(x) = e^{-x}. (a) Expand f(x+h)f(x+h) as a Taylor series in hh about xx, keeping every term up to and including the one in h2h^2, and use it to show that Dhf(x)−f′(x)=12hf′′(x)+O(h2).D_hf(x) - f'(x) = \tfrac{1}{2}hf''(x) + \mathcal{O}(h^2). (b) Given f′′(x)=e−xf''(x) = e^{-x}, evaluate the coefficient of hh in the error at x=1x=1. (c) A ratio table built by halving hh for f(x)=e−xf(x)=e^{-x} at x=1x=1 gives a measured coefficient (the number multiplying hh) of 0.1840.184. Compare it with the symbolic value.

Browse the problem library