Write central derivative function of : $f’’(x)$ where $f(x)=e^x$
Conditions : $f(x+h)$ , $f(x-2h)$ , $f(x)$ should appear only .
I solved using Taylor series the lecturer says it’s O($h^2$) but I got O(h).
Can someone help please
Write central derivative function of : $f’’(x)$ where $f(x)=e^x$
Conditions : $f(x+h)$ , $f(x-2h)$ , $f(x)$ should appear only .
I solved using Taylor series the lecturer says it’s O($h^2$) but I got O(h).
Can someone help please
By Taylor's theorem, we have \begin{align*}&f(x+h) = f(x) + f^{\prime}(x)h + \frac{1}{2}f^{\prime\prime}(x)h^2 + O(h^3) \text{ and}\\ &f(x-2h) = f(x) - 2f^{\prime}(x)h + 2f^{\prime\prime}(x)h^2 + O(h^3)\end{align*} Thus \begin{align*}2f(x+h)+f(x-2h) = 3f(x)+3f^{\prime\prime}(x)h^2 + O(h^3)\end{align*} which gives \begin{equation*}f^{\prime\prime}(x) = \frac{2f(x+h)+f(x-2h)-3f(x)}{3h^2} + O(h)\end{equation*} If we go one term further, we get \begin{align*}&f(x+h) = f(x) + f^{\prime}(x)h + \frac{1}{2}f^{\prime\prime}(x)h^2 + \frac{1}{6}f^{\prime\prime\prime}(x)h^3 + O(h^4) \text{ and}\\ &f(x-2h) = f(x) - 2f^{\prime}(x)h + 2f^{\prime\prime}(x)h^2 - \frac{4}{3}f^{\prime\prime\prime}(x)h^3 + O(h^4)\end{align*} so \begin{equation*}4f(x+h)-f(x-2h) = 3f(x) + 6f^{\prime}(x) + 2f^{\prime\prime\prime}(x)h^3 + O(h^4) \quad (*)\end{equation*} If we truncate the two equations at the $h$ term instead, we get \begin{equation*}f(x+h)-f(x-2h) = 3f^{\prime}(x)h + O(h^2)\end{equation*} This gives an expression for $f^{\prime}(x)$ that we can substitute into $(*)$, giving \begin{equation*}4f(x+h)-f(x-2h) =3f(x)+2\left(\frac{f(x+h)-f(x-2h)}{h}\right) +2f^{\prime\prime\prime}(x)h^3 + O(h^4)\end{equation*} This rearranges to \begin{equation*}f^{\prime\prime\prime}(x) = \frac{4f(x+h)-f(x-2h)-3f(x)}{2h^3}-\frac{f(x+h)-f(x-2h)}{h^4}+O(h)\end{equation*}