Nonlinear second order ODE $y''+f(x)y=g(x)y^3$

I encountered the following ODE in order to find a solution for Einstein equation $$y''+f(x)y=g(x)y^3.$$ It seems to me that it is not among the solvable nonlinear second order differential equations. Is there any known method to solve that? Any help will be appreciated.

• It is difficult to say something if you do not say anything on the structure of coefficients $f(x)$ and $g(x)$: could you say more on them? – Daniele Tampieri Jul 24 '19 at 6:03
• With $f$ and $g$ constant, this equation has exact solutions in terms of Jacobi elliptic functions. – Jon Jul 24 '19 at 6:14
• The functions $f$ and $g$ are sufficiently smooth and not constant. – Masoud Jul 24 '19 at 6:31
• You can take $f,g\in\mathbb{R}$, excluding the trivial case $f=g=0$, and your solution, when $g\ne 0$ is expressed using the Jacobi function ${\rm sn}(x,k)$. Indeed, this equation is a definition of that function by itself. When $f$ and $g$ are not constant, you are in trouble to get a closed form solution unless for special cases or numerically. Already the linear case with $g(x)=0$ can be generally hard. Finally, a perturbative WKB approach could be helpful. – Jon Jul 24 '19 at 8:04

When $$g(x) = 2$$ (which can be achieved by a transformation in $$x$$) and $$f(x)$$ is linear in $$x$$, then this equation is a special case of the second Painlevé equation, which also appears in other areas of mathematical physics. It is known to be integrable by the isomonodromy method via its Lax representation and it has many other interesting properties.
While closed-form solutions will be very rare, you can get series solutions. For example, the solution with $$y(0)=0,\; y'(0)=v$$ has Maclaurin series
$$y = v x - \frac{f(0)}{6} v x^3 - \frac{f'(0)}{12} v x^4 + \left(\frac{f(0)^2 - 3 f''(0)}{120} v + \frac{g(0)}{20} v^3 \right) x^5 + \ldots$$
The paper by Norbert Euler (1997) Transformation Properties of $$\ddot{x}+f_1(t)\dot{x} + f_2(t)x + f_3(t) x^n = 0$$" Journal of Nonlinear Mathematical Physics, 4:3-4, 310-337
describes in detail the "the most general conditions on the functions $$f_1$$, $$f_2$$ and $$f_3$$, by which the equation may be integrable, as well as conditions for the existence of Lie point symmetries."