Example

> restart:f:=x->ln(cos(x));

[Maple Math]

> df:=D(f):ddf:=D(df):dddf:=D(ddf);

[Maple Math]

> plot(dddf,-1..1);

[Maple Plot]

So that the third derivative is bounded by 10.

>

> for i from 1 to 3 do h:=10.^(-i): df1a:=1/(2*h)*(-3*f(0.4)+4*f(0.4+h)-f(0.4+2*h)): maxerra:=(h^2)*10./3:acterra:=abs(df1a-df(0.4)): df1b:=1/(2*h)*(f(0.4+h)-f(0.4-h)): maxerrb:=(h^2)*10./6:acterrb:=abs(df1b-df(0.4)): print(h,df1a,maxerra,acterra); print(h,df1b,maxerrb,acterrb);od:

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

It is clear that more accurate results are obtained for a fixed value of [Maple Math] as compared to forward or backward differences. Also, the centered three-point formula tends to yield more accurate results then the non-centered one.

Again, there will be an optimal value of [Maple Math] because of round-off error.