I want to do a quick study and some tests on the planet-star dynamics ( including the movement of the star). I'm looking for a code that simulates some planets orbiting a star. I've tried searching online and the ones that I found are either incomplete or do not seem to give realistic results. With that in mind I'm wondering if there is any code/package that does this already (in Python).

  • 1
    $\begingroup$ What codes have you tried, and how did they fall short? REBOUND looks interesting but it's hard to guess whether it would meet your needs. $\endgroup$ – Mike G Feb 12 at 18:26
  • $\begingroup$ Would a planetarium simulation help? I assume the planet orbits are input but cant swear to that. $\endgroup$ – jmh Feb 13 at 0:49
  • $\begingroup$ I just edited my answer and mentioned a few more options $\endgroup$ – uhoh Feb 14 at 1:12

There are of course serious Python packages to simulate solar systems out there, one of which might be found in The random walk of cars and their collision probabilities with planets but I think that other answers that will be posted will give a more complete answer.

I looked into a "roll your own" script as described in answers to How to calculate the planets and moons beyond Newtons's gravitational force? If you don't need to propagate for millions of years, it should be pretty easy and extremely instructive to just do the numerical simulation yourself.

update: The Python package Poliastro may also do exactly what you need (poliastro in Space SE), and while Skyfield does not do this, there are rumblings in Github issues about adding an orbit propagator to it in the future. PyEphem has been depreciated (same developer as Skyfield) but I believe it also does orbit propagation of user-specified objects, though I'm not sure if it's n-body or just Keplerian orbits.

I think that Universe Sandbox will work for you. See also Is a General Relativity approximation available in Universe Sandbox (1 or 2)?

Though it is a complete program and not in Python, Scott Manley talks about Universe Sandbox in several videos.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.