# How to perform taylor expansion with numerical differentiation formula

I am attempting to perform taylor expansion on the following numerical differentiation formula:

$f'''(0) = \frac {−f(−3h/2) + 3f(−h/2) − 3f(h/2) + f(3h/2)) }{ h^3 }$

Over the reference interval [−3h/2, 3h/2]

After the derivation of the weights using Lagrange polynomials, the result is:

$p'''0 = f0*l_0'''(0) + f1*l_1'''(0) + f2*l_2'''(0) + f2*l_3'''(0)$

$\frac {-f0 + 3f1 - 3f2 + f3} {h^3}$

Where $f0 = (-3h/2), f1 = (-h/2), f2 = (h/2), f3 = (3h/2)$

When trying to find the leading error term with Taylor expansion, my leading error term is $\frac {-3}{2h^2} fo'$. This gives an order of accuracy equal to -2.

The taylor expansion is done as follows:

$\frac {-f0 + 3f1 - 3f2 + f3} {h^3} - f'''0$

$\frac {1} {h^{3}} (-f0 + 3(f0 +(-h/2)f0' + ...) - 3(f0 +(h/2)f0' + ...) + (f0 +(3h/2)f0' + ...))-f'''0$

Am I doing something wrong?

• To see if you did something wrong we first need to see what you did? What reasoning led to your error formula? – Dr. Lutz Lehmann Nov 17 '15 at 11:02
• I updated my question to provide more details. – stevetronix Nov 17 '15 at 16:38

You should decide which of the formulas $$\frac{-f(x)+3f(x+h)-3f(x+2h)+f(x+3h)}{h^3}$$ or $$\frac{-f(x-3h/2)+3f(x-h/2)-3f(x+h/2)+f(x+3h/2)}{h^3}$$ you are actually considering and then stay with it. Your Taylor expansions mix (partial) terms from both formulas.
• Then your expansion should be around $h=0$, which is not reflected in your computations. – Dr. Lutz Lehmann Nov 17 '15 at 23:12