# How can I implement a bvp problem in a non uniform grid?

I want toconstruct a difference method for the the numerical approximation of the solution of the following boundary value problem: $$u:[a,b]\to \mathbb{R}$$ function,such that $$-u''(x)=f(x)$$ and $$u(a)=0, u(b)=0$$ using a non-uniform grid of the form :

\begin{align*} x_{0} =& a \\ x_{1} =& x_{0} +h_{1} \\ x_{2} =& x_{1} + h_{2} \\ \vdots \\ x_{N} =& x_{N-1} + h_{N}\\ x_{N+1} =& b \end{align*}

where : $$h_{i} = x_{i} - x_{i-1}$$

for all $$i = 1,\dots,N + 1.$$

and write the resulting linear system. But how can I do this?

• It seems to be a homework problem. Please do it yourself. Atleast make an attempt and show us where you reach, and then ask some specific doubt. – cfdlab Oct 17 at 4:38