Back to Browse

Three Body Problem In Python - Earth's Orbit

1.8K views
Jun 5, 2021
13:25

The three body problem coded in python. This shows the Earth's orbit around the sun using 3 body calculations, i.e. summing all forces with F = G * m1 * m2 / r^2 Then generating the accelerations, velocities, and locations. This process would work in theory with any number of objects in space. In practice, this is an O(N^2) calculation so it would probably run into compute issues if you got more than a couple thousand objects. Here I approximate the Earth's orbit. I got my values for Earth's initial location and velocity from https://socratic.org/questions/what-is-the-velocity-of-earth-at-perihelion-and-aphelion-how-is-this-information#:~:text=Earth's%20perihelion%20velocity%20is%2030.28,velocity%20is%2029.3%20km%2Fs. http://curious.astro.cornell.edu/our-solar-system/41-our-solar-system/the-earth/orbit/85-how-fast-does-the-earth-go-at-perihelion-and-aphelion-intermediate#:~:text=At%20perihelion%2C%20Earth's%20distance%20from,a(1%2Be).&text=So%20plugging%20in%20the%20numbers,aphelion%20it's%2029%2C300%20m%2Fs. https://www.thoughtco.com/aphelion-and-perihelion-1435344#:~:text=Earth%20orbits%20the%20Sun%20in,of%20the%20ellipse%20is%20called Although I probably have some things slightly wrong A copy of what is shown here https://pastebin.com/qbfu049n The videos I created using Manim to animate the locations generated by this 3 body problem backend, which I did not include in the paste above. All Code # Copyright 2021 Google LLC # SPDX-License-Identifier: Apache-2.0 # https://www.apache.org/licenses/LICENSE-2.0 The thumbnail image is Public domain created by Nasa. I got it from here https://commons.wikimedia.org/wiki/File:Solar_sys.jpg

Download

1 formats

Video Formats

360pmp422.0 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Three Body Problem In Python - Earth's Orbit | NatokHD