Generally you convert the second order ODE in the first order:
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