Suppose you are solving a system of equations numerically that possesses an attractor (no matter the initial conditions set, all the different solutions will approach a specific set of values that comprise the so-called attractor). The numerical method employed is a fourth-order Runge-Kutta one.
Now suppose you take the end values of your attractor solution and integrate backwards in time. Is it normal that the resulting curve deviate from the original attractor trajectory and ends up ''diverging''?
In principle my guess is that it shouldn't have to follow the original attractor solution because of the different solutions that converged to it. However, the fact that it eventually diverges is what makes me think that the code I am using is wrong.
EDIT:
At the request of a user, I write the equations:
$\dot x = y$
$\dot y = -\frac{\sqrt{3}}{2}y\sqrt{y^2+\frac{1}{2}x^4}-x^3$
dot denotes time derivative.
The code is:
def rk4trial(f,v0,t0,tf,n,V):
t=np.linspace(t0,tf,n)
h=t[1]-t[0]
v=v0
for j in range(n):
V.append(v)
k1=f(v,t[j])*h
k2=f(v+0.5*k1,t[j]+0.5*h)*h
k3=f(v+0.5*k2,t[j]+0.5*h)*h
k4=f(v+k3,t[j]+h)*h
v=v+(k1+2*k2+2*k3+k4)/6
return V, t, h
When integrating backwards, I simply set tf as initial time and t0 as final time and use the end values as initial conditions.