Exercise: comparing derivative formulas

Computing f(0.5)f'(0.5) for f(x)=x2exf(x)=x^2e^{-x} with the six finite-difference formulas and comparing their errors against the exact value 0.45490.4549.

Data and comparison

With f(x)=x2exf(x)=x^2e^{-x}, step h=0.25h=0.25 and nodes x={0,0.25,0.5,0.75,1}x=\{0,\,0.25,\,0.5,\,0.75,\,1\}, we approximate f(0.5)f'(0.5). The analytic value is f(0.5)=0.4549f'(0.5)=0.4549. The table gives each approximation and its absolute error.

Formulaf'(0.5)Error ε
Progresiva O(h)0.45630.0014
Progresiva 3 puntos O(h²)0.48010.0252
Regresiva O(h)0.41180.0431
Regresiva 3 puntos O(h²)0.52040.0655
Central O(h²)0.43410.0208
Central 5 puntos O(h⁴)0.45610.0012