# Analytically solving this second order ODE

I try to solve this second order differential equations to get $$\phi$$:

$$4 \Psi \left( \ddot{\phi}_0+ \frac{a^2}{2\phi_0}\dot{\phi}_0 \right) = -\ddot{\phi}+ \left( \frac{a^2 \mathcal{H}}{2\phi_0} \mathcal{H} + \frac{a^2 \dot{\phi}_0}{\phi_0} \right) \dot{\phi}- \left( 3 k^2 - \frac{a^2 \ddot{\phi}_0}{\phi_0} - \frac{\mathcal{H} a^2 \dot{\phi}_0}{\phi_0} - \frac{2 a \dot{a} \dot{\phi}_0}{\phi_0} + \frac{a^2 \dot{\phi}_0}{\phi_0^2}+ \frac{\mathcal{H} a^2}{\phi_0} - \frac{a^4 \dot{\phi_0}}{4\phi^2_0} \right) \phi ~~~~~~~~~~~~ (1)$$

Where $$\Psi$$ is defined from this ODE:

$$\left( k^2 + 3 \mathcal{H}^2 +3 \mathcal{H} \frac{a^2\dot{\phi}_0}{2\phi_0} \right) \Psi = - \frac{\ddot{\phi}}{2\phi_0} + \dot{\phi} \left( \frac{\mathcal{H}}{2\phi_0} + \frac{\dot{\phi_0}}{2\phi_0} - \frac{a^2 \mathcal{H}}{2\phi_0} \right) + \phi \left( \frac{\mathcal{H} \dot{\phi_0}}{\phi_0} + \frac{5\mathcal{H}a^2}{2\phi_0}-\frac{a^4 \dot{\phi}_0}{4\phi^2_0} \right) ~~~~~~(2)$$

Both $$\phi$$ and $$\Psi$$ are functions of t. $$\dot{\phi}=\frac{\partial}{\partial ~t} \phi$$, and $$\ddot{\phi}=\frac{\partial^2}{\partial^2t} \phi$$.

$$a(t) = t + \frac{t^2}{2}, H(t) = \frac{\dot{a}}{a},~ \phi_0(t) =- \frac{e^{-Ht}}{H}$$ and $$k$$ is a constant.

So when substituting by (2) into (1) and all the variables, I get a single second-order differential equation in $$\phi$$

Here is the code that I try:

a[t_]= t + t^2/2; h[t_]= Derivative[1][a][t]/a[t]; f0[t_]= -(Exp[-2*h[t]*t]/h[t]); df0[t_]= D[f0[t], t]; ddf0[t_]= D[f0[t], {t, 2}];

y[t_] := (1/(k^2 + 3*h[t] + 3*h[t]*((a[t]^2*df0[t])/(2*f0[t]))))*(-(Derivative[2][x][ t]/(2*f0[t])) + (Derivative[1][x][t]/(2*f0[t]))*(h[t] + df0[t] - a[t]^2*h[t]) + (x[t]/(2*f0[t]))*(2*h[t]*df0[t] + 5*h[t]*a[t]^2 - (a[t]^4/(2*f0[t]))*df0[t]))

eq := Simplify[-Derivative[2][x][ t] + (Derivative[1][x][t]/f0[t])*((a[t]^2/2)*h[t] + h[t]*f0[t] + a[t]^2*df0[t]) - (x[t]/f0[t])*(3*k^2*f0[t] - a[t]^2*ddf0[t] - h[t]*a[t]^2*df0[t] - 2*a[t]*Derivative[1][a][t]*df0[t] + (a[t]^2*df0[t])/f0[t] + h[t]*a[t]^2 - (a[t]^4*df0[t])/(4*f0[t])) - 4*y[t]*(ddf0[t] + (a[t]^2/(2*f0[t]))*df0[t])]

Where $$x(t)=\phi (t)$$ , $$y(t)=\Psi (t)$$ and $$f0(t) =\phi_0(t)$$. Ofcourse DSolve doesn't work with eq. So I tried:

AsymptoticDSolveValue[{eq == 0, x[0] == 0, Derivative[1][x][0] == 1}, x[t], {t, 0, 10}]

But it also doesn't give a solution. Hint: the initial conditions are arbitrary.

Another Hint: this equation can not be solved numerically because $$k$$ is an unknown constant.

So I appricticate any help in finding an analytic solution for this equation.

• What is the parameter range of k ? Commented Apr 1 at 11:59
• Would the quasi-static/subhorizon approximation work in your case? Getting the full analytical solution might be very difficult, that's why there are the Boltzmann codes out there ;-) Commented Apr 1 at 13:32
• Why do you expect there to be an analytic solution to this equation? Analytic solutions are rare, especially for nonlinear equations like yours. I'd be surprised if there was one here, unless you can find some conserved quantities or something to simplify the differential equation. Of course, that's a math problem rather than a Mathematica one. Commented Apr 1 at 15:15
• @UlrichNeumann. $-5<k<5$. Commented Apr 1 at 15:18
• @Dr.phy Your ode seems to be singulaer near t==0: {Coefficient[eq, x''[t]] /. t -> 0, Asymptotic[eq /. x''[t] -> 0, t -> 0]} (*{-3, -((4 x[0])/(E^2 t)) + (3 Derivative[1][x][0])/t}*) Commented Apr 1 at 15:59

To eliminate the singlarity t==0(see my comment) try workaround

dt = .001;
X = ParametricNDSolveValue[{eq == 0, x[dt] == 0,Derivative[1][x][dt] == 1}, x, {t, dt, 10}, k ]


solution k=-5,-4,...,5

Plot[Table[X[k][t], {k, -5, 5}], {t, dt, 10}, PlotRange -> All]


Hope it helps!

• fyi, you can just do dt = $MachineEpsilon; and it works also. Commented Apr 2 at 7:23 • Thanks so much. Now I'm thinking can we get an analytic expression from this numeric solution? for instance by making fitting .. But can be this done with two variables$k$and$t\$? @UlrichNeumann Commented Apr 2 at 10:38
• @Dr.phy You need an analytical formula? If not you can use X[k][t] like a build in function Commented Apr 2 at 17:17
• I'm asking can we get an analytic formula from this numerical solution. @UlrichNeumann Commented Apr 3 at 4:27
• @UlrichNeumann. Could you look at this thread pls? mathematica.stackexchange.com/questions/301410/… Commented Apr 3 at 20:40