Determine the accuracy of a difference operator as an approximation of $\frac{d}{dx}\left(a(x) \frac{du}{dx} \right)$

46 Views Asked by At

Let $u(x)$ and $a(x)$ be smooth functions. Determine the order of accuracy of $$ \frac{(a_{i+1} + a_i)(u_{i+1} - u_i) - (a_i + a_{i-1})(u_i - u_{i-1})}{2h^2} $$ as an approximation to $\frac{d}{dx}\Big(a(x) \frac{du}{dx} \Big)\bigg|_{x_i},$ where $h$ is the mesh width and $a_i = a(x_i)$ and $u_i = u(x_i).$


My attempt: This looks reminiscent of $\frac{f_{i+1} - f_i}{h} = \frac{df}{dx}\bigg|_{x_i} + {\cal O}(h),$ where $f_{i+1} = \frac{(a_{i+1} + a_i)}{2}\frac{(u_{i+1} - u_i)}{h}.$ So my thought its that $f_i$ must approximate $\Big(a(x) \frac{du}{dx} \Big)\bigg|_{x_i}$ to some order (possibly ${\cal O}(h)$), but then I am not sure how these approximations compound anyway. In other words, if $f_i$ does approximate $\Big(a(x) \frac{du}{dx} \Big)\bigg|_{x_i}$ to ${\cal O}(h),$ then would the whole thing be to ${\cal O}(h)$ or ${\cal O}(h^2),$ I'd guess the former. Does anyone see a more rigourous way to approach this?

Thanks in advance.

1

There are 1 best solutions below

1
On

You want to estimate $\frac{(a_{i+1}+a_i)(u_{i+1}-u_i)-(a_i+a_{i-1})(u_i-u_{i-1})}{2h^2}-\frac{d}{dx} \left ( a(x) \frac{du}{dx} \right )$. Begin by expanding $a_{i+1},a_{i-1},u_{i+1},u_{i-1}$ about $x=x_i$. Since the result only depends on $a(x),\frac{da}{dx}$ and $\frac{d^2u}{dx^2}$, it makes sense to start by only expanding to first order in $a$ and second order in $u$, but of course it might turn out that the accuracy is better than that (in which case you should take a higher order expansion).

Just your argumentation is not really sufficient, because while you do find that the two terms in the numerator (absorbing a factor of $2h$ from the denominator for this analysis, just as you did) are $a(x) \frac{du}{dx}+O(h)$, you don't know what's left behind when you do the subtraction, what's in that $O(h)$ matters: indeed it is where the quantity you actually want to approximate "lives". So you need a more precise analysis like I suggested.