# How to solve this 2nd order, nonlinear ODE numerically?

How should I solve this second order, nonlinear ODE?: $$\left(\frac{f''(x)}{B}\right)^n=-(f(x)-a_0-a_1x-\cdots -a_mx^m)^n+A$$ Where $A,B>0$, $n$ is a large odd number and $m\approx 100$, and $f$ and $g$ are real-valued functions on a compact interval.

Any help would be appreciated. Thanks!

$$f'(x(t)) = \frac{\partial f}{\partial x} x'(t) = g(x(t))x'(t)$$
$$f''(x(t))= \frac{\partial g}{\partial x} (x'(t))^2 + g(x(t))x'(t)$$
where $g = f'$. Now you can write $k(x,f,g,x')=0$ as an implicit ODE. You can then let MATLAB do the heavy lifting with ode15i.
The basic idea is that you can change this differential algebraic equation (DAE) to a numerical equation by approximating $x'(t)=\frac{x_n+1 - x_n}{h}$, plug this in to get an implicit equation for $x_{n+1}$, and thus to step forward you need to use an implicit solver. This is a crude approximation and you can do better. Details can be found here: http://faculty.smu.edu/shampine/cic.pdf