[Math] Derivation of forward/backward/central difference methods from taylor series

numerical methodsordinary differential equationstaylor expansion

I'm trying to learn more about finite difference methods here.

Theorically using the taylor series $u(x)=\sum_{n=0}^{\infty}\frac{(x-x_i)^n}{n!}(\frac{d^nu}{dx^n})_i $ you can get the forward/backward/central difference methods, which are:

forward: $(\frac{du}{dx})_i\approx\frac{u_{i+1}-u_i}{\Delta x}$

backward: $(\frac{du}{dx})_i\approx\frac{u_{i}-u_{i-1}}{\Delta x}$

central: $(\frac{du}{dx})_i\approx\frac{u_{i+1}-u_{i-1}}{2\Delta x}$

But I'm having a rough time trying to understand how the above taylor series is being expanded to obtain the difference methods. The fact of not having very clear how taylor works and that subindex notation is confusing me. In the lecture says that $u_i \approx\ {u(x_i)}$ and $x_i=i\Delta x$

Also, the lecture I'm following introduces FDM saying that:

$\frac{\delta u}{\delta x}(x)=\lim_{x\to 0} \frac{u(x+\Delta x) – u(x)}{\Delta x} = \lim_{x\to 0} \frac{u(x)-u(x-\Delta x)}{\Delta x} = \lim_{x\to 0} \frac{u(x+\Delta x)-u(x-\Delta x)}{2\Delta x} $

But how can i prove those equations are equals, any idea?

Best Answer

The index notation just means on the derivative just means evaluated at $x_i$,

$$ u(x) = u(x_i) + \left.\frac{du}{dx}\right|_{x = x_i}(x - x_i) + \frac{1}{2!}\left.\frac{d^2u}{dx^2}\right|_{x = x_i}(x - x_i)^2 + \cdots $$

Forward

Take $x = x_{i + 1}$

$$ u(x_{i +1}) \approx u(x_i) + \left.\frac{du}{dx}\right|_{x_i}(x_{i+1} - x_{i}) + \frac{1}{2}\left.\frac{d^2u}{dx^2}\right|_{x_i}(x_{i+1} - x_{i})^2 + \cdots \tag{1} $$

up to first order in $\Delta x = (x_{i+1}-x_i)$ this becomes

$$ \left.\frac{du}{dx}\right|_{x_i} \approx \frac{u(x_{i +1}) - u(x_{i})}{\Delta x} $$

Backward

Same deal as before, just use the point $x_{i-1}$ instead

$$ u(x_{i -1}) \approx u(x_i) + \left.\frac{du}{dx}\right|_{x_i}(x_{i-1} - x_{i}) + \frac{1}{2}\left.\frac{d^2u}{dx^2}\right|_{x_i}(x_{i-1} - x_{i})^2 + \cdots \tag{2} $$

truncating at first order and solving for the derivative:

$$ \left.\frac{du}{dx}\right|_{x_i} \approx \frac{u(x_{i }) - u(x_{i-1})}{\Delta x} $$

Central

If you subtract Eq (2) from Eq (1) you get

$$ \left.\frac{du}{dx}\right|_{x_i} \approx \frac{u(x_{i+ 1}) - u(x_{i-1})}{2\Delta x} $$

Related Question