I was solving the following non-linear BVP by second order finite difference method.
The BVP is $y'' + 3yy'=0$ with boundary conditions $y(0) = 2$ and $y(2)=1$.
While looking at the solution it has used the following scheme-
$$y = \frac{y_{i+1}+y_{i-1}}{2}$$ $$y' = \frac{y_{i+1}-y_{i-1}}{2h}$$ $$y'' = \frac{y_{i+1}-2y_{i}+y_{i-1}}{h^2}$$
and solved the BVP using Newton's method which I got it. But I am thinking that why it has assumed the first condition in such a way,I guess that it has to do something with second order finite difference but how do i relate this?
The second expression $y'$ is similar to the central difference and also $y''$ is similar to the formula for second order derivatives.
EDIT:-
Now if there is an $x$ term,what should I replace $x$ with ? like i did for $y,y',y''$? like for example $y'' + 3xyy' = 0$ then $x$ must be substituted with? as I did for $y,y',y''$?
How do I relate these assumptions to second order finite difference method?
In practice, a second-order differential equation is recast into a first-order system. By setting $Y=(y_1,u_2)^\top$ where $y_1 = y$ and $y_2=y'$, we have $$ Y' = (y_2, -3 y_1 y_2)^\top = F(Y) \, , $$ which an autonomous first-order ODE system. An initial value problem of the type $Y(x_0) = Y_0$ can be solved numerically using for instance Runge-Kutta methods. In the second case, $$ Y' = (y_2, -3 x y_1 y_2)^\top = F(x,Y) $$ is non-autonomous, and Runge-Kutta methods still apply. The resolution of a boundary value problem with such conditions as $y(x_0) = y_0$ and $y(x_1) = y_1$ can be achieved using the shooting method.