Numerical method to solve a boundary value problem