Derivation
Consider the result of Theorem 10 with
the linear polynomial fit to two data points:
We can take the derivative of both sides of this expression. First, we get
> P1:=x->((x-x[1])/(x[0]-x[1]))*f(x[0])+((x-x[0])/(x[1]-x[0]))*f(x[1]);
> x[1]:=x[0]+h:x[0]:=x0:dp1:=diff(P1(x),x);
where we have used the notation
. The error term becomes:
> err:=(D@@2)(f)(xi(x))*(x-x[0])*(x-x[1])/2;
> diff(err,x);
This is not a very useful expression. Manipulating this error term is made difficult by the unknown quantity
and the way it depends on
. However, this part of the error term vanishes if we evaluate it at either
or
. The two formula obtained respectively are
,
.
The former formula is known as the forward-difference formula, the latter as the backward-difference formula. Both can be written in the first form if we allow
.
If the second derivative of
is bounded over the interval
, i.e.
, then the maximum error is given by
.
>
>
>