Consider the following FDM problem:
Find $u$ such that $$ -u^{\prime \prime}(x)+b(x) u^{\prime}(x)+c(x) u(x)=f(x) ~~\text { in }(0,1), $$ and conditions $u(0) = u(1) = 0$, where $$ b(x)=x^{2}, \qquad c(x)=1+x, \qquad f(x)=-2+13 x^{2}+3 x^{3}-x^{4}-5 x^{5}. $$
I am trying to find an upper bound on the local truncation error using finite difference method (forward, backward, and centered). So far, I have the following:
Approximate $u\left(x_{i}\right)$ respectively by $U_{i}, V_{i}$, and $W_{i}$, where $U_{i}$ is the solution of the finite-difference scheme: $$ \frac{1}{h^{2}}\left[-U_{i-1}+2 U_{i}-U_{i+1}\right]+\frac{b_{i}}{h}\left[U_{i}-U_{i-1}\right]+c_{i} U_{i}=f_{i}, \tag3$$ $V_{i}$ is the solution of $$ \frac{1}{h^{2}}\left[-V_{i-1}+2 V_{i}-V_{i+1}\right]+\frac{b_{i}}{h}\left[V_{i+1}-V_{i}\right]+c_{i} V_{i}=f_{i}, \tag4$$ and $W_{i}$ is the solution of $$ \frac{1}{h^{2}}\left[-W_{i-1}+2 W_{i}-W_{i+1}\right]+\frac{b_{i}}{2 h}\left[W_{i+1}-W_{i-1}\right]+c_{i} W_{i}=f_{i}, \tag5$$ with $U_{0}=V_{0}=W_{0}=U_{N+1}=V_{N+1}=W_{N+1}=0$.
I know that I have to use Taylor's formula, but don't know how find the upper bound on the local truncation error for (3), (4), and (5), or even how to derive the truncation error.
I am also trying to find the order. (3) has order O(h2), and the other two have order O(h) - is this correct?
Can anyone help me here?
Looking at the last scheme, the approximations being used are are follows:
$$ u''(x_i) = \frac{1}{h^2}\left(u(x_{i+1})-2u(x_i)+u(x_{i-1})\right)-\frac{h^2}{12} u^{(4)}(\xi_i) $$
$$ u'(x_i) = \frac{1}{2h}(u(x_{i+1})-u(x_{i-1})) + \frac{h^2}{6}u^{(3)}(\zeta_i) $$
So, when you write the equation at $x = x_i$, and denote $W_i = u(x_i)$, you get $$ -\dfrac{W_{i+1}-2W_i+W_{i-1}}{h^2} + b_ i \dfrac{W_{i+1}-W_{i-1}}{2h} + c_i W_i = f_i + E_i $$ where $E_i = -\frac{h^2}{14} u^{(4)}(\xi_i)-\frac{h^2}{6}\cdot b_i \,u^{(3)}(\zeta_i)$.
Since the system your will actually solve does not include the $E_i$ terms, the global error can now be estimated by standard perturbation analysis on the rhs of a linear system. Basically, you are solving some system $A W = F$, instead of $A(W+\delta W) = F+ \delta F$, which leads to an (absolute) error estimate $\|\delta W\| \leq \|A^{-1}\| \|\delta F\|$.