Solving second order differential equation numerically with values given at intermediate points. I need to numerically solve the equation,
\begin{equation}
y''(x) + p(x)y(x) = 1
\end{equation}
in the range [a,b]
with conditions
\begin{eqnarray}
y'(\alpha) &=& 1\\
y(\beta) &=& 0  \hspace{1cm} a <\alpha < \beta <b
\end{eqnarray}
if the conditions were given for either of the endpoints, i.e.
\begin{eqnarray}
y'(a) &=& 1\\
y(a) &=& 0  
\end{eqnarray}
I can find $y(a+\Delta x)$ using these conditions and rest of the solution can
be found from discretization,
\begin{eqnarray}
\frac{y(x+\Delta x) - 2y(x) + y(x-\Delta x)}{\Delta x^2} + p(x)y(x) = 1
\end{eqnarray}
But if initial value/derivatives are known at different points(that are not successive in discretization) then how can I proceed?
 A: I think you can proceed in two different manners:


*

*Solve the problem in the grid corresponding to $x\in [\alpha,\beta]$ and then solve the two initial value problems given by:
$$y_L''+p(x) y_L=1,  \quad a < x < \alpha, \quad y_L(\alpha) = y(\alpha),  \quad y_L'(\alpha) = y_L(\alpha) \tag{1}$$
$$y_R''+p(x) y_R=1,   \quad \beta < x < b, \quad y_R(\beta) = y(\beta), \quad y_R'(\beta) = y_R(\beta) \tag{2}$$
on different suitable grids. Note that the problem for $y_L$ moves backwards and the change of variable $z \equiv \alpha -x$ can fix this issue. Besides, note that $(1)$ and $(2)$ are initial value problems for which you may or may not use another numerical method to solve them.

*The other option would be, provided you adapt your mesh so $\alpha$ and $\beta$ are nodes of the grid, to subsitute the discretized boundary conditions at $x=\alpha$ and $\beta$ while $y_0$ and $y_{N}$ (first and last values of $y_j \approx y(x_j)$) remains unknown (I think this approach is a bit more tedious).
Hope this helps.
Cheers!
