Round Two on Finite Difference Approximations of Derivatives

There is another way to obtain the results stated in “Finite Difference Approximations of Derivatives“.

Let y'_i, y''_i denotes y'(x_i) and y''(x_i) respectively and,

h=x_{i+1}-x_i=x_i-x_{i-1} >0.

We define

y'_i = \alpha_1 y_{i-1} + \alpha_2 y_{i+1}\quad\quad\quad(1).

By Taylor’s expansion around x_i,

y_{i-1} \approx y_i + y'_i(-h)+\frac{y''_i}{2!}(-h)^2\quad\quad\quad(1-1)

y_{i+1} \approx y_i + y'_ih+\frac{y''_i}{2!}h^2\quad\quad\quad(1-2)

Substituting (1-1), (1-2) into (1),

y'_i \approx \alpha_1 y_i - \alpha y'_ih +\alpha_1\frac{y''_i}{2}h^2 + \alpha_2 y_i +\alpha_2y'_i h +\alpha_2\frac{y''_i}{2}h^2.

That is,

y'_i \approx (\alpha_1+\alpha_2) y_i +(\alpha_2-\alpha_1)h y'_i + (\alpha_1+\alpha_2)\frac{y''_i}{2}h^2.

It follows that

\begin{cases} \alpha_1+\alpha_2=0 \\ (\alpha_2-\alpha_1)h=1\\ \alpha_1+\alpha_2=0 \end{cases}\quad\quad\quad(1-3)

Fig. 1

Solving (1-3) for \alpha_1, \alpha_2 (see Fig. 1) yields

\alpha_1=-\frac{1}{2h}, \alpha_2=\frac{1}{2h}.

Therefore,

y'_i \approx -\frac{1}{2h} y_{i-1} + \frac{1}{2h} y_{i+1} = \frac{y_{i+1}-y_{i-1}}{2h}

or,

\boxed{y'_i \approx \frac{y_{i+1}-y_i}{2h}}

Now, let

y''_i = \alpha_1y_{i-1}+\alpha_2 y_i + \alpha_3 y_{i+1}.

From

y_{i-1} \approx  y_i - y'_i h + \frac{y''_i}{2!} h^2

and

y_{i+1} \approx y_i +y'_i h + \frac{y''_i}{2!}h^2,

we have,

y''_i \approx \alpha_1 y_i - \alpha_1 y'_i h + \frac{\alpha_1}{2}y''_i h^2 + \alpha_2 y_i + \alpha_3 y_i + \alpha_3 y'_i h + \frac{\alpha_3}{2}y''_i h^2.

It leads to

\begin{cases} \alpha_1+\alpha_2+\alpha_3=0\\-\alpha_1+\alpha_3=0\\(\frac{\alpha_1}{2}+\frac{\alpha_3}{2})h^2=1 \end{cases}

Fig. 2

whose solution (see Fig. 2) is

\alpha_1 = \frac{1}{h^2}, \alpha_2 = -\frac{2}{h^2}, \alpha_3=\frac{1}{h^2}.

Hence,

y''_i \approx \frac{1}{h^2}y_{i-1}-\frac{2}{h^2}y_i +\frac{1}{h^2}y_{i+1}=\frac{y_{i-1}-2y_i+y_{i+1}}{h^2}

i.e.,

\boxed{ y''_i \approx \frac{y_{i+1}-2y_i + y_{i-1}}{h^2}}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s