I need to use finite difference method without introducing fiction points to solve the following problem:

$−\mu u′′(x)+\eta u′(x)+\sigma u(x)=f(x)$, $a<x<b,$ subject to the boundary conditions $u′(a) = \alpha$ and $u′(b) = \beta $.

I discretize the derivatives with second order central differences formulas at interior points ($a < x < b$), but use one-sided forward and backward differences to approximate the boundary conditions (at $x = a$ and at $x = b$).

$u_1 - u_0 = \alpha h$;

$u_N - u_{N-1} = \beta h$

At $i=0$ I have to introduce a fiction point of $x_{-1}$:

$(-\mu + \eta h/2)u_{1} + (2 \mu + \sigma h^2)u_0 + (-\mu - \eta h/2)u_{-1}=f_0 h^2$

What am I doing wrong? Thank you


Those one-sided differences aren't what you want because the central difference approximations to the derivatives have error $O(h^2)$ and the one-sided differences have error $O(h)$. So you can expand in Taylor series about $x=a$: $$\begin{align}x_0&=x_0\\ x_1&=x_0+hx_0^{\prime}+\frac12h^2x_0^{\prime\prime}+O(h^3)\\ x_2&=x_0+2hx_0^{\prime}+2h^2x_0^{\prime\prime}+O(h^3)\end{align}$$ You want $c_0x_0+c_1x_1+c_2x_2=x_0^{\prime}+O(h^2)$. Comparing coefficients of like derivatives of $x_0$, we get $$\begin{align}c_0+c_1+c_2&=0\\ c_1+2c_2&=\frac1h\\ \frac12c_1+2c_2&=0\end{align}$$ With solution $c_0=-\frac3{2h}$, $c_1=\frac2h$, and $c_2=-\frac1{2h}$, so now your boundary condition reads $$\frac{-3u_0+4u_1-u_2}{2h}=\alpha$$ The other boundary condition reads something like $$\frac{u_{N-2}-4u_{N-1}+3u_N}{2h}=\beta$$ You don't need the equations with $h^2f_0$ and $h^2f_N$ because you are using the boundary conditions at $x=a$ and $x=b$.

  • $\begingroup$ ok. But how do you construct this system of equations for unknowns c? $\endgroup$
    – Pol
    Feb 25 '19 at 20:08
  • $\begingroup$ I just plugged in the Taylor series for $x_0$, $x_1$, and $x_2$ to get $$\begin{align}c_0x_0+c_1x_1+c_2x_2&=(c_0+c_1+c_2)x_0+(c_1+2c_2)hx_0^{\prime}+\left(\frac12c_1+2c_2\right)h^2x_0^{\prime\prime}\\ &=(0)x_0+(1)x_0^{\prime}+(0)x_0^{\prime\prime}\end{align}$$ So really I was comparing coefficients of $x_0$, $x_0^{\prime}$, and $x_0^{\prime\prime}$ to get the $3$ equations for $c_0$, $c_1$, and $c_2$. $\endgroup$ Feb 26 '19 at 3:29

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.