how to solve $x''=f(x)$ numerically? I know how to solve when $f(x)$ is linear, but how to solve the equation $x''=f(x)$ with $f$ a unknown nonlinear function using numerical methods? 
Any references would be helpful. Thanks!
Update: Sorry that I am not clear about it, what I mean is the exact form of $f$ is unknown, but you can think it as a black box and you can get values at any points from $f$. 
 A: Generally you convert the second order ODE in the first order:
$$
\begin{pmatrix}
    v'\\
    x'
\end{pmatrix} = 
\begin{pmatrix}
    f(x)\\
    v
\end{pmatrix}
$$
Here I used a notation common in mathematical physics where generally the new variable $v$ is the velocity, i.e. the first derivate.
Now you use a double step:


*

*first you solve  $v' = f(x)$

*after you solve $x' = v$


Until this point there is no difference between the linear and the non linear case.
The difference is the choice of the numerical method. For the non linear case an 
implicit method involve to solve non linear equation, this can be a delicate passage
where you must determine how and which solution to consider. For example think the case that come from a dynamic problem where $f$ is quadratic with the velocity and try to use the most simple implicit method as Eulero implicit.
So in general you use IMEX methods where you use an explicit discretization for the non linear terms and implicit for the linear terms. In your problem you do not know the form of $f$ and you can not split the operator, so you can use an explicit numerical scheme for the first equation and an implicit scheme for the second.
As explicit scheme you can choice, for example, a scheme as Adam-Bashord

For some equation is possible to solve it without the reduction to the first order, see Numerov's method
