<p>Your units look all mixed up.</p>
<p>You set G to SI units, but you do nothing with this value, so the simulator will continue to use <code>sim.G = 1</code>.  If you are setting G to SI units then when you add planets they will be in SI units.</p>
<p>You add a star with mass 0.09. Since this is implied by your choice of G to be kg, this means 0.09kg  You then add two planets with mass about 1 kg at distance of about 0.02 and 0.04 metres.</p>
<p>Of course, that's not what you intended.  See the <a href="https://rebound.readthedocs.io/en/latest/units/" rel="noreferrer">rebound page on units</a> You'll need to choose a consistent unit system, and stick to it.  It's often convenient to use units of &quot;solar mass&quot;, &quot;AU&quot; and &quot;2-pi years&quot;, so that G=1, but then all your bodies must be specified in those units. You can't use &quot;Solar mass&quot; for one body, &quot;Earth masses&quot; for another, and put G in SI units.</p>

CC BY-SA 4.0
2023-09-05T02:23:42.507Z
2023-09-05T02:23:42.507Z
James K
<p>I am a junior in high school working on an independent research project and I need help because I've reached the limits of my knowledge. My goal is to simulate the long-term orbital dynamics of exoplanetary systems, focusing on the stability of planets within the habitable zone of their host stars using the Python software called Rebound. I wrote code in Python simulating Teegarden's Star system (<a href="https://exoplanetarchive.ipac.caltech.edu/overview/Teegarden%27s%20Star%20b#planet_Teegarden-s-Star-b_collapsible" rel="nofollow noreferrer">data collected from NASA Exoplanet Archive</a>). I'm certainly not an expert in Python, I only learned this summer, and I'm not sure if my graphs or my code are correct. I'm not entirely sure how to apply the resulting information to my research on the stability of the exoplanet system. How should I interpret this data? Am I missing part of the code that is required? I'm not sure my approach is correct and I'm hoping someone with Rebound experience can help point me in the right direction. Many thanks for any help you can provide me.</p>
<p>Here is a link to a google doc with the code that I used to produce the results: <a href="https://docs.google.com/document/d/12Iog2bf5k8YO4403OHrviTZiFYBK2LRBg__Rkqn6-A8/edit?usp=sharing" rel="nofollow noreferrer">https://docs.google.com/document/d/12Iog2bf5k8YO4403OHrviTZiFYBK2LRBg__Rkqn6-A8/edit?usp=sharing</a></p>
<p>When I run my simulation, this is the information that I am receiving back:</p>
<p>-0.0281975035917293
&lt;rebound.Orbit instance, a=-0.028197503591729303 e=4611.268321685149 inc=0.0 Omega=0.0 omega=5.2541912879453285 f=1.0645580662541025&gt;
&lt;rebound.Orbit instance, a=-0.03760609591029579 e=436.75849882502456 inc=3.141592653589793 Omega=0.0 omega=0.7006863036104045 f=5.546079371470007&gt;</p>
<p><a href="https://i.sstatic.net/zXvTB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zXvTB.png" alt="enter image description here" /></a>
<a href="https://i.sstatic.net/6Hqvb.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6Hqvb.png" alt="enter image description here" /></a></p>

<observational-astronomy><exoplanet><python><n-body-simulations>
Help with simulating long-term orbital dynamics of exoplanetary systems using Rebound
HSStudent
# Help with simulating long-term orbital dynamics of exoplanetary systems using Rebound

(Asked by: username_0 on 2023-09-05)

I am a junior in high school working on an independent research project and I need help because I've reached the limits of my knowledge. My goal is to simulate the long-term orbital dynamics of exoplanetary systems, focusing on the stability of planets within the habitable zone of their host stars using the Python software called Rebound. I wrote code in Python simulating Teegarden's Star system ([data collected from NASA Exoplanet Archive](https://exoplanetarchive.ipac.caltech.edu/overview/Teegarden%27s%20Star%20b#planet_Teegarden-s-Star-b_collapsible)). I'm certainly not an expert in Python, I only learned this summer, and I'm not sure if my graphs or my code are correct. I'm not entirely sure how to apply the resulting information to my research on the stability of the exoplanet system. How should I interpret this data? Am I missing part of the code that is required? I'm not sure my approach is correct and I'm hoping someone with Rebound experience can help point me in the right direction. Many thanks for any help you can provide me.

Here is a link to a google doc with the code that I used to produce the results: <https://docs.google.com/document/d/12Iog2bf5k8YO4403OHrviTZiFYBK2LRBg__Rkqn6-A8/edit?usp=sharing>

When I run my simulation, this is the information that I am receiving back:

-0.0281975035917293

[![enter image description here](https://i.sstatic.net/zXvTB.png)](https://i.sstatic.net/zXvTB.png)
[![enter image description here](https://i.sstatic.net/6Hqvb.png)](https://i.sstatic.net/6Hqvb.png)

**Tags:** observational-astronomy, exoplanet, python, n-body-simulations

---

## 1 answers

### Answer by username_1 on 2023-09-05. Score: 5

Your units look all mixed up.

You set G to SI units, but you do nothing with this value, so the simulator will continue to use `sim.G = 1`. If you are setting G to SI units then when you add planets they will be in SI units.

You add a star with mass 0.09. Since this is implied by your choice of G to be kg, this means 0.09kg You then add two planets with mass about 1 kg at distance of about 0.02 and 0.04 metres.

Of course, that's not what you intended. See the [rebound page on units](https://rebound.readthedocs.io/en/latest/units/) You'll need to choose a consistent unit system, and stick to it. It's often convenient to use units of "solar mass", "AU" and "2-pi years", so that G=1, but then all your bodies must be specified in those units. You can't use "Solar mass" for one body, "Earth masses" for another, and put G in SI units.


---

