I am using a Runge-Kutta fourth order method to solve numerically the usual equation of motion of a background scalar field in curved spacetime with a quartic potential:


$'$ denoting the derivative w.r.t. the e-folds number $\textrm{d}N=H\textrm{d}t$ and, from the Friedmann equation:

$H^2=\frac{\lambda \phi^4}{4}\frac{1}{3M_{Pl}^2-(1/2)\phi^{'2}}$;


The problem comes when integrating backwards using as the initial conditions the final values I got after integrating forward. The outcome blow up without matching the values obtained before, when integrating forward. I simply do not understand where the problem is as both the equation and the code are not unknown whatsoever. Firstly, I integrated from 0 to 64 e-folds. Then I simply reverse the integration direction.

I attach the code too:

def rk4trial(f,v0,t0,tf,n,V):  
    for j in range(n):  
    return v, t, h

def Fdet(v,t):
    phi, sigma = v
    return np.array([sigma,-3*(1+HH/3)*sigma-lamb*phi**3/(H**2)])

  • 1
    $\begingroup$ Based on my understanding from what you wrote here, I would say your assumption to think that if you integrate an ODE forward in time and reach a final point and then use that final point as initial condition to integrate backward in time and reproduce the same values as in forward integration is simply wrong! Why?! Just look at your ODE... you have $\phi^{'}$ which change its sign with T transformation: $\phi^{'}(-t) = - \phi^{'} (t)$. So, as long as you have that viscous part: $3 (1+\frac{H^{'}}{3H}) \phi^{'}$, nothing will be reversible here... $\endgroup$ Oct 14, 2019 at 16:01
  • 1
    $\begingroup$ You can think of your equation as a Langevin Equation and you should know Langevin Dynamics is not reversible unless there is no viscous or non-conservative force involved which is not the case in your equation. $\endgroup$ Oct 14, 2019 at 16:03
  • $\begingroup$ @AloneProgrammer: Thanks for commenting. I solved that equation w/o the $\phi^3$ term, and it actually reproduces the values as in forward integration. It seems that term is the responsible, but I don't know why. $\endgroup$
    – user33042
    Oct 14, 2019 at 16:38

1 Answer 1


Based on my understanding from your question, I assume you are looking for to examine time reversibility of your ODE:

$$\phi^{''}(t) = - 3 (1+\frac{H^{'}(t)}{3 H(t)}) \phi^{'} (t) - \lambda \frac{\phi^{3}(t)}{H^{2}(t)} = 0$$


$$H(t) = \frac{\lambda \phi^{4}(t)}{4(3M_{Pl}^{2}-0.5\phi^{'}(t)^{2})}$$


$$H^{'}(t) = -\frac{1}{2M_{Pl}^{2}} \phi^{'}(t)^{2} H(t)$$

Your initial ODE is in the form of a Langevin equation with a viscous term of $3 (1+\frac{H^{'}(t)}{3 H(t)}) \phi^{'} (t)$. Your Langevin equation is not time-reversible due to the fact that the equation will not remain the same under T transformation. Simply because first-order derivative $\phi^{'}(t)$ change its sign to negative under T transformation: $$\phi^{'}(-t) = -\phi^{'}(t)$$

  • $\begingroup$ Thanks for commenting, but I also ask why the outcome blow up when going backwards. Thanks to your previous comment, I see why both set of results don't match, but what I don't really understand is why the results diverge in backward integration. $\endgroup$
    – user33042
    Oct 14, 2019 at 16:58
  • $\begingroup$ @J.J It's clear... There is no reason that if your forward integration was stable, the backward one also should be stable... $\endgroup$ Oct 14, 2019 at 17:00
  • 2
    $\begingroup$ @AloneProgrammer One would actually expect it to be unstable if the forward time direction is stable. For example $\dot{x}=A\,x$ is forwards stable if all eigenvalues of $A$ have negative real part. Reversing the time direction would be equivalent to simulating $\dot{x}=-A\,x$ in the forwards direction, which also negates all eigenvalues of $A$ and make it unstable in the backwards direction. Only if there are other equilibria or limit cycles then the solution might stay bounded. $\endgroup$
    – fibonatic
    Oct 15, 2019 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.