central difference approximation used in the second partial differential equation=second-order accurate?

179 Views Asked by At

Currently I am trying to solve the following ordinary differential equation for $\mu$: $$-\mu''+\pi^2cos^{2}(\pi x)\mu(x)=f(x)\quad x\in [0,1]$$ with boundary conditions: $$\mu (0)=0,\mu(1)=1.$$ I used the central difference approximation method to estimate $\mu''$: I begin by discretizing the interval $[0,1]$. Consider the gridpoints: $$x_i=ih,\quad i=0,1,\cdots,n+1,\quad h=\frac{1}{n+1},\quad h_i=x_{i+1}-x_i=h.$$ Then I gained $$\frac{g_{i+1}-2g_i+g_{i-1}}{h^2}=g_i''+O(h^2)$$ where $g_i=g(x_i)$. Then I gained the linear system of equations: $$-\frac{g_{i+1}-2g_i+g_{i-1}}{h^2}+\pi^2 \cos^2 (\pi x_i )\, g_i = f(x_i)\ \ i=1,2,\dots,n.\quad (1)$$ How can I prove that Scheme (1) is second-order accurate? I am getting a bit confused about the relationship between $g_i$ and $u_i$. I have come across several scholarly discussions recommending the use of the ratio of the error between the true solution and the numerical solution to $O(h^2)$ to establish a proof. However, I am uncertain about the specific methodology to construct the error between the true and numerical solutions.

Any help would be greatly appreciated! Thank you!!!!!!