In [1]:
%matplotlib inline
In [2]:
import rebound as r;r.add(["Sun","Mars"]);x=[]
while r.t<9:r.integrate(r.t+.1);x+=[r.particles[1].x]
import matplotlib.pyplot as m;m.plot(x)
Out[2]: