<p>There are of course serious Python packages to simulate solar systems out there, one of which might be found in <a href="https://arxiv.org/abs/1802.04718" rel="nofollow noreferrer">The random walk of cars and their collision probabilities with planets</a> but I think that other answers that will be posted will give a more complete answer.</p>

<p>I looked into a "roll your own" script as described in answers to <a href="https://space.stackexchange.com/q/23408/12102">How to calculate the planets and moons beyond Newtons's gravitational force?</a> 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.</p>

<p><strong>update:</strong> The Python package <a href="https://pypi.org/project/poliastro/" rel="nofollow noreferrer">Poliastro</a> may also do exactly what you need (<a href="https://space.stackexchange.com/search?q=poliastro">poliastro in Space SE</a>), and while <a href="https://rhodesmill.org/skyfield/" rel="nofollow noreferrer">Skyfield</a> does not do this, there are rumblings in Github issues about adding an orbit propagator to it in the future. <a href="https://pypi.org/project/ephem/" rel="nofollow noreferrer">PyEphem</a> 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.</p>

<p>I think that <a href="https://en.wikipedia.org/wiki/Universe_Sandbox" rel="nofollow noreferrer">Universe Sandbox</a> will work for you. See also <a href="https://astronomy.stackexchange.com/q/26803/7982">Is a General Relativity approximation available in Universe Sandbox (1 or 2)?</a> </p>

<p>Though it is a complete program and not in Python, Scott Manley talks about Universe Sandbox in <a href="https://www.youtube.com/user/szyzyg/search?query=sandbox" rel="nofollow noreferrer">several videos</a>. </p>

<ul>
<li>old one from 2014 is <a href="https://youtu.be/2JDYSmzYuyE" rel="nofollow noreferrer">Universe Sandbox 2 (Alpha) - Simulate The Universe For Fun!</a></li>
<li><a href="https://youtu.be/McsIvz1mwa4" rel="nofollow noreferrer">"The Goblin" and an Exomoon The Size Of Neptune - Universe Sandbox</a></li>
<li><a href="https://youtu.be/TM11Jahqeys" rel="nofollow noreferrer">Universe Sandbox² - Planet Nine, Asteroids Orbiting Earth &amp; more</a></li>
</ul>

CC BY-SA 4.0
2020-02-27T16:13:37.967Z
Thank you for the complete answer! Poliastro seems to be the one that best fits my interests from those mentioned, I will let you know if everything works!
T. Silva
CC BY-SA 4.0
2020-02-27T17:01:25.597Z
@T.Silva that's great news; it will be great to hear how it goes, thanks!
uhoh
CC BY-SA 4.0
2020-02-13T03:52:43.693Z
2020-02-14T01:11:57.817Z
2020-02-14T01:11:57.817Z
uhoh
<p>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). </p>

CC BY-SA 4.0
2020-02-12T18:26:23.077Z
What codes have you tried, and how did they fall short? [REBOUND](https://rebound.readthedocs.io/en/latest/) looks interesting but it's hard to guess whether it would meet your needs.
Mike G
CC BY-SA 4.0
2020-02-13T00:49:02.477Z
Would a planetarium simulation help?  I assume the planet orbits are input but cant swear to that.
Natsfan
CC BY-SA 4.0
2020-02-14T01:12:54.210Z
I just edited my answer and mentioned a few more options
uhoh
CC BY-SA 4.0
2020-02-27T16:14:21.433Z
Thank you for the answers, REBOUND seems perfect for what I wanted and have been working with it for the past few days and getting results, thank you!
T. Silva
<planet><exoplanet><n-body-simulations>
Code/Package for multiple planet simulation
T. Silva
# Code/Package for multiple planet simulation

(Asked by: username_0 on 2020-02-12)

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).

**Tags:** planet, exoplanet, n-body-simulations

> **Comments:**
> **username_1**: What codes have you tried, and how did they fall short? [REBOUND](https://rebound.readthedocs.io/en/latest/) looks interesting but it's hard to guess whether it would meet your needs.  
> **username_2**: Would a planetarium simulation help?  I assume the planet orbits are input but cant swear to that.  
> **username_3**: I just edited my answer and mentioned a few more options  
> **username_0**: Thank you for the answers, REBOUND seems perfect for what I wanted and have been working with it for the past few days and getting results, thank you!  

---

## 1 answers

### Answer by username_3 on 2020-02-13. Score: 2

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](https://arxiv.org/abs/1802.04718) 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?](https://space.stackexchange.com/q/23408/12102) 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](https://pypi.org/project/poliastro/) may also do exactly what you need ([poliastro in Space SE](https://space.stackexchange.com/search?q=poliastro)), and while [Skyfield](https://rhodesmill.org/skyfield/) does not do this, there are rumblings in Github issues about adding an orbit propagator to it in the future. [PyEphem](https://pypi.org/project/ephem/) 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](https://en.wikipedia.org/wiki/Universe_Sandbox) will work for you. See also [Is a General Relativity approximation available in Universe Sandbox (1 or 2)?](https://astronomy.stackexchange.com/q/26803/7982)

Though it is a complete program and not in Python, Scott Manley talks about Universe Sandbox in [several videos](https://www.youtube.com/user/szyzyg/search?query=sandbox).

* old one from 2014 is [Universe Sandbox 2 (Alpha) - Simulate The Universe For Fun!](https://youtu.be/2JDYSmzYuyE)
* ["The Goblin" and an Exomoon The Size Of Neptune - Universe Sandbox](https://youtu.be/McsIvz1mwa4)
* [Universe Sandbox² - Planet Nine, Asteroids Orbiting Earth & more](https://youtu.be/TM11Jahqeys)

> **Comments:**
> **username_0**: Thank you for the complete answer! Poliastro seems to be the one that best fits my interests from those mentioned, I will let you know if everything works!  
> **username_3**: @T.Silva that's great news; it will be great to hear how it goes, thanks!  

---

