Second order central difference = first order central difference applied twice?

$\begingroup$

Approximating the 1st order derivative via central differences can be written as $ \delta_{2h}u(x) =\frac{u(x+h) - u(x-h)}{2h} \approx u'(x) .$

What is the main issue with applying again a central difference to compute $u''(x)$?

In this case,

$\delta_{2h}u'(x) = \frac{u'(x+h) - u'(x-h)}{2h} \approx \frac{u(x+2h) + u(x-2h) - 2u(h)}{4h^2}.$

This is actually different from what most sources on finite differences consider the second order approximation using central differences, i.e.

$ u''(x) \approx \frac{u(x+h)+u(x-h)-2u(x)}{h^2},$

which is achieved for a step-size of $\frac{1}{2}h$.

What is the problem with the first interpretation and why do most sources require that one uses the half step size (apart from the obvious loss of numerical accuracy, is there any logical fallacy)?

$\endgroup$ 1

2 Answers

$\begingroup$

$$u(x+h)= u(x)+u'(x)h+\frac{1}{2}u''(x)h^2+\mathcal{O}(h^2)$$ $$u(x-h)= u(x)-u'(x)h+\frac{1}{2}u''(x)h^2+\mathcal{O}(h^2)$$

The common formula is obtained not assuming "half step size" , but by adding the above formula together.

Your result is similar to looking at the below formula, the steps are larger. $$u(x+2h)= u(x)+u'(x)2h+\frac{1}{2}u''(x)(2h)^2+\mathcal{O}((2h)^2)$$ $$u(x-2h)= u(x)-u'(x)2h+\frac{1}{2}u''(x)(2h)^2+\mathcal{O}((2h)^2)$$

$\endgroup$ $\begingroup$

I assume you meant to write $\delta_{2h}u'(x) = \frac{u'(x+h) - u'(x-h)}{2h} \approx \frac{u(x+2h) + u(x-2h) - 2u(\color{red}{x})}{4h^2}$ because $u'(x+h)-u'(x-h)=\frac{u(x+h+h)-u(x+h-h)}{2h}-\frac{u(x-h+h)-u(x-h-h)}{2h}=\frac{1}{2h}(u(x+2h)-2u(x)+u(x-2h))$

This makes the question only about why the step-size $h$ is often chosen as half of the $h$ that you used.

$h$ can be any number (as long as it is small enough to be of use). Assume you have an unknown function $f(x)$ but you can measure its value at any $x$ you'd like to. You measure that function at some $x$, then again at $x+a$ and so on. $a$ is just some arbitrarily chosen step size for these measurements.
If you use $h:=a$ as step-size for the central difference, you will get your equation. If you instead use $h:=\frac{a}{2}$, you get the equation you were asking about:
$ u''(x) \approx \frac{u(x+a)+u(x-a)-2u(x)}{a^2}$

Think about these values as the data points you measured: $u(x+a)$ is one of the measured values. So in total, you only need $3$ data points to approximate $u''(x)$ when you use $h:=\frac{a}{2}$. That is one to the left and one to the right of $u(x)$.
With your version of the formula, you wold need two data points on each side of $u(x)$. This is annoying at the boundaries, because you need to measure more points than you can calculate $u''$ at - you need two data points more than the other formula.

The logic of both versions is sound though.

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like