Truncation error and the second centered difference approximation $\frac{d^2u}{dx^2}$ at $x = x_{j}$ ?.

4.8k Views Asked by At

The second centered difference approximation $\frac{d^2u}{dx^2}$ at $x = x_{j}$?.

By expanding the terms $u(x_{j}+h)$ and $u(x_{j} - h)$ about the point $x_{j}$ with a Taylor series,we need to prove that the truncation error $T_{j}$ in the approximation satisfies $T_{j} = -\frac{h^2}{12}\frac{d^4 u(x_{j})}{dx^4} +$ terms with higher powers of $h$.

From central difference approximation

$$u'(x_{j}) = \frac{u(x_{j}+h) - u(x_{j}-h)}{2h}$$ $$u''(x_{j}) = \frac{u'(x_{j}+h) - u'(x_{j}-h)}{2h}$$ $$u''(x_{j}) = \frac{u(x_{j}+2h) - 2u(x_{j}) + u(x_{j}-2h)}{4h^2}$$ From Taylor series expansion $u(x_{j}+2h) = u(x_{j}) + 2hu'(x_{j}) + \frac{(2h)^2}{2!}u''(x_{j})+ \frac{(2h)^3}{3!}u'''(x_{j}) + \frac{(2h)^4}{4!}u''''(x_{j})+h.o.t$

$u(x_{j}-2h) = u(x_{j}) - 2hu'(x_{j}) + \frac{(2h)^2}{2!}u''(x_{j})- \frac{(2h)^3}{3!}u'''(x_{j}) + \frac{(2h)^4}{4!}u''''(x_{j}) -h.o.t$

So that

$$u(x_{j}+2h)+u(x_{j}-2h)-2u(x_{j}) = 4h^2u''(x_{j})+\frac{4}{3}h^4 u''''(x_{j})+...$$

$$u''(x_{j}) = \frac{u(x_{j}+2h)+u(x_{j}-2h)-2u(x_{j})}{4h^2} = u''(x_{j})+\frac{1}{3}h^2 u''''(x_{j})+...$$

Now i get that error $T_{j} = \frac{1}{3}h^2 u''''(x_{j})$ but I am not getting the required one $T_{j} = -\frac{h^2}{12} u''''(x_{j})$.

Where am I doing wrong?

2

There are 2 best solutions below

2
On

The difference in the constant is because you are using $2\,h$ instead of $h$. The Taylor expansion gives $$ \frac{u(x+h)-2\,u(x)+u(x-h)}{h^2}=u''(x)+\frac{h^2}{12}\,u''''(x)+O(h^5), $$ and $$ u''(x)-\frac{u(x+h)-2\,u(x)+u(x-h)}{h^2}=-\frac{h^2}{12}\,u''''(x)+O(h^5). $$

0
On

Since $h>0$ can take any value, you can use the substitution $\bar h=2h$ and you get the same term. Note that the important part in the truncation error is the exponent of $h$ (and, possibly, the maximum for the derivative); the constant is not too significant.

However, the derivation of the second order centered differentiation formula is obtained adding the Taylor expansions directly:

$$u(x_j+h)= u(x_j) + u'(x_j)h + \frac{1}{2}u''(x_j)h^2 + \frac{1}{6}u'''(x_j)h^3 + \frac{1}{24}u''''(x_j)h^4 + \mathcal{O}(h^5)$$ $$u(x_j-h)= u(x_j) - u'(x_j)h + \frac{1}{2}u''(x_j)h^2 - \frac{1}{6}u'''(x_j)h^3 + \frac{1}{24}u''''(x_j)h^4 + \mathcal{O}(h^5)$$

so

$$u(x_j+h) + u(x_j-h) - 2u(x_j) = u''(x_j)h^2 + \frac{1}{12}u''''(x_j)h^4 + \mathcal{O}(h^5)$$