I'm looking to derive Taylor’s Series F’’ to 4th order: The final answer is F’’=(-F(x+2h)+16F(x+h)-30F(x)+16F(x-h)-F(x-2h))/(12h^2) + O(h^4)
I'm just not sure how to get -1 16 -30 16 -1, Can anyone give me some guidance?
I'm looking to derive Taylor’s Series F’’ to 4th order: The final answer is F’’=(-F(x+2h)+16F(x+h)-30F(x)+16F(x-h)-F(x-2h))/(12h^2) + O(h^4)
I'm just not sure how to get -1 16 -30 16 -1, Can anyone give me some guidance?
You can easily derive the correct expression as follows. We can formally write down the Taylor expansion of a function as:
$$\exp(h D)f(x) = f(x+h)$$
where $D$ is the differential operator. Then we can find many possible ways to express the derivative in terms of finite differences by writing the r.h.s. in terms of finite difference operators. E.g. we can write:
$$f(x+h) = (1+\Delta)f(x)$$
where $\Delta$ acts on $f$ as:
$$\Delta f(x) = f(x+h) - f(x)$$
We can thus write:
$$\exp(h D)f(x) = (1+\Delta)f(x)$$
This allows you to formally express the differential operator in terms of the finite difference operator.
While this will yield a formally correct expression, it will be in terms of forward differences and will thus yield an asymmetric expression. What we want here is a symmetric expression, but this obtained in just the same say, you just consider the symmetric finite difference expression:
$$\left[\exp(h D)-\exp(-h D)\right]f(x) = f(x+h) - f(x-h)$$
We can write this as:
$$\sinh(h D)f(x) = \Delta_s f(x)$$
where $\Delta_s$ is the average between the forward and backward finite difference. We can thus formally write:
$$D = \frac{1}{h}\operatorname{arcsinh}{\left(\Delta_s\right)} = \frac{1}{h}\left[\Delta_s - \frac{\Delta_s^3}{6 } + \frac{3 \Delta_s^5}{40 }-\frac{5 \Delta_s^7}{112 }+\cdots\right] $$
The second derivative operator is easily expressed in terms of finite differences by squaring the series, we have:
$$D^2 = \frac{1}{h^2}\left[\Delta _s^2 -\frac{\Delta _s^4}{3 }+\frac{8 \Delta _s^6}{45 } -\frac{4 \Delta _s^8}{35 }+\cdots\right]\tag{1}$$
To get to the desired approximation we need the first two terms of this series. To compute the powers of $\Delta _s$, it is convenient to introduce the shift operator $E$ that acts like:
$$E f(x) = f(x+h) $$
Then we have:
$$\Delta_s = \frac{E - E^{-1}}{2}$$
Therefore:
$$\Delta_s^2 =\frac{1}{4}\left[E^2 - 2 + E^{-2}\right]$$
and
$$\Delta_s^4 =\frac{1}{16}\left[E^4 -4 E^2 + 6 - 4 E^{-2} + E^{-4}\right]$$
Therefore the first two terms of Eq. 1 yields:
$$ D^2f(x)\approx\frac{1}{h^2}\left[-\frac{1}{48} f(x+4 h) + \frac{1}{3}f(x+2h) - \frac{5}{8} f(x) + \frac{1}{3} f(x-2 h) - \frac{1}{48} f(x-4h)\right] $$
Since only even multiples of $h$ occur here we can replace $h$ by $\frac{h}{2}$:
$$D^2f(x)\approx \frac{1}{12 h^2}\left[-f(x+2 h) + 16 f(x+h) - 30 f(x) + 16 f(x- h) - f(x-2h)\right]$$