0

Prove that the following is a fourth order accurate approximation of the second derivative of a function $f$: $$f''(x_0) = \frac{-f(x_0+2h)+16f(x_0+h)-30f(x_0)+16(x_0-h)-f(x_0-2h)}{12h^2} + O(h^4)$$ Find the leading order error term.

Here are my workings below, 1. Are they correct? 2. How do I find the leading order error term? looking for some help with this

Using taylor expansion:

$$ f(x_0+h) = f(x_0) + h f'(x_0) + \frac{h^2}{2} f''(x_0) + \frac{h^3}{6} f'''(x_0) + O(h^4) $$

$$ f(x_0-h) = f(x_0) - h f'(x_0) + \frac{h^2}{2} f''(x_0) - \frac{h^3}{6} f'''(x_0) + O(h^4) $$

$$ f(x_0+2h) = f(x_0) + 2h f'(x_0) + 2 h^2 f''(x_0) + \frac{4 h^3}{3} f'''(x_0) + O(h^4) $$

$$ f(x_0-2h) = f(x_0) - 2h f'(x_0) + 2 h^2 f''(x_0) - \frac{4 h^3}{3} f'''(x_0) + O(h^4) $$

Calculate: $$ -f(x_0 + 2h) + 16f(x_0 + h) - 30f(x_0) + 16f(x_0 - h) - f(x_0 -2h) $$

Which is $$ \begin{aligned} & - \left[ f(x_0) + 2h f'(x_0) + 2 h^2 f''(x_0) + \frac{4 h^3}{3} f'''(x_0) \right] \\ & +16 \left[ f(x_0) + h f'(x_0) + \frac{h^2}{2} f''(x_0) + \frac{h^3}{6} f'''(x_0) \right] \\ & -30 f(x_0) \\ & +16 \left[ f(x_0) - h f'(x_0) + \frac{h^2}{2} f''(x_0) - \frac{h^3}{6} f'''(x_0) \right] \\ & - \left[ f(x_0) - 2h f'(x_0) + 2 h^2 f''(x_0) - \frac{4 h^3}{3} f'''(x_0) \right] \\ & + O(h^4) \end{aligned} $$

Which evaluates to $ 12 h^2 $ to give the required result.

user123
  • 879
  • 7
  • 20

2 Answers2

2

No, your expression evaluates to $12h^2\color{red}{f''(x_0)+O(h^4)}$, not $12h^2$, which doesn't give you the error estimate $+O(h^4)$ (only $+O(h^2)$) after you divide by the denominator $12h^2$.

To get the explicit $O(h^4)$ term means you need to expand to order (at least) 6. To save space, I'll note that since the numerator $$S:=-f(x_0+2h)+16 f(x_0+h)-30 f(x_0)+16 f(x_0-h)-f(x_0-2h)$$ is even in $h$ only the even-order derivatives appear. Writing $[h^n]F$ for the coefficient of $h^n$ in the Taylor series expansion of a (sufficiently smooth) function $F(h)$, we have \begin{align} [h^n](f(x_0+mh))&=[h^n]\left(\sum_{j=0}^n f^{(j)}(x_0)\frac{(mh)^j}{j!}+o(h^n)\right)\\ &=\frac{f^{(n)}(x_0)}{n!}m^n \end{align} so $$ \boxed{\color{blue}{[h^n]S=\frac{f^{(n)}(x_0)}{n!}\bigg[-(2)^n+16(1)^n-30(0)^n+16(-1)^n-(-2)^n\bigg]}} $$ For even $n>0$, $$ -(2)^n+16(1)^n-30(0)^n+16(-1)^n-(-2)^n =-2(2^n-16) $$ So we can write down the coefficients immediately \begin{align} [1]S&=0\\ [h^2]S&=\frac{-2(2^2-16)}{2!}f^{(2)}(x_0)=12f''(x_0)\\ [h^4]S&=0\\ [h^6]S&=\frac{-2(2^6-16)}{6!}f^{(6)}(x_0)=-\frac{2}{15}f^{(6)}(x_0). \end{align} Hence $$ S=12f''(x_0)h^2-\frac{2}{15}h^6f^{(6)}(x_0)+o(h^6), $$ which rearranges to $$ f''(x_0)=\frac{S}{12h^2}+\left(\frac{1}{90}f^{(6)}(x_0)+o(1)\right)h^4. $$ I.e., the leading order error term is $\frac{1}{90}f^{(6)}(x_0)h^4$.

user10354138
  • 33,239
1

Your expression is the Richardson extrapolant of the simple central second order difference quotient $$ D_2(h)=\frac{f(x+h)-2f(x)+f(x-h)}{h^2}=f''(x)+\frac{h^2}{12}f^{(4)}(x)+\frac{2h^4}{6!}f^{(6)}(x)+\frac{2h^6}{8!}f^{(8)}(x)+... $$ Using the Richardson extrapolation formula for second order errors $D_4(h)=\frac{4D_2(h)-D_2(2h)}{3}$ one gets \begin{align} D_4(h)&=\frac{4f(x+h)-8f(x)+4f(x-h)}{3h^2}-\frac{f(x+2h)-2f(x)+f(x-2h)}{12h^2} \\[1em] &=\frac{-f(x+2h)+16f(x+h)-30f(x)+16f(x-h)-f(x-2h)}{12h^2} \\[1em] &=f''(x)-\frac{8h^4}{6!}f^{(6)}(x)-\frac{40h^6}{8!}f^{(8)}(x)-... \end{align}

Lutz Lehmann
  • 126,666
  • thanks for your submission, is this a complete solution? – user123 Nov 08 '18 at 15:26
  • Yes, it show that the divided differences formula has error order $4$ by applying the extrapolation formula to all terms on both sides. – Lutz Lehmann Nov 08 '18 at 15:32
  • so then what is the leading order error term? – user123 Nov 08 '18 at 15:35
  • The first on the right that still depends on $h$, of the lowest degree. – Lutz Lehmann Nov 08 '18 at 15:43
  • could you edit that in to your solution? also this solution is different then the other given, in your opinion is the other wrong? – user123 Nov 08 '18 at 15:46
  • It is $\frac{8}{6!}=\frac{1}{3\cdot5\cdot 6}=\frac1{90}$, the final formula is the same as in the other answer, only the approach is a different one, I'm synthetic, constructing the formula from a more simple one, the other analytic, inserting Taylor series into the given formula. – Lutz Lehmann Nov 08 '18 at 15:49
  • okay so both answers are the same? but just using different methods to arrive at the same solution? – user123 Nov 08 '18 at 15:58