Skip to main content

The N-Body Problem

what is it
    Newton tried to use analytical geometry to predict the planets' motions from its orbital properties (position, orbital diameter, period and orbital velocity) and failed
    realised that there is a gravitational interaction between the planets that is affecting their orbits
    In the solar system, every planet is gravitationally affected by all the other planets to some degree.
    This is also true for other bodies inside and outside the solar system
    it is easy to calculate the gravitationally interactive forces between two bodies using newtonian physics
    as soon as there are more than two bodies involved, things get harder to predict
    This technique is pretty close to reality -- the moon landings used newtonian mechanics to calculate their orbits -- but it has to be said that einstein showed that there are small micro-interactions between bodies that newtonian physics cannot predict

why is it hard
    This is because every body's gravity influences all the other bodies orbital parameters, which in turn influence all OTHER bodies
    for n bodies, there are n^2 interactions to calculate
    you have to take all bodies into account, or your result will be very imprecise
    You can use this to find bodies you don't know about: Plug all bodies you know about into the equations, calculate, and if the result differs from reality, Boom, you know where to look for your new dark moon

approximation using Barnes-Hut
    organise all bodies into an octo-tree (or quad-tree for 2d), ordered by their distance from each other
    each Body is a leaf on the end of the tree, and saves its mass, plus its orbital parameters
    save the combined mass of the attached bodies for each node
    for far away bodies, do not calculate every body's mass and gravitational interaction individually -- instead, with increasing distance, retreat further and further up the tree and use the mass information in the upper nodes
    it can be proven that due to the inverse square root relation of gravity to mass over distance, this only gives us very small errors as opposed to calculating every individual body
    However, the complexity sinks from O(n^2) to O(n log n)

Reference Code (java)

http://physics.princeton.edu/~fpretori/Nbody/code.htm

Sources

https://en.m.wikipedia.org/wiki/Barnes–Hut_simulation https://en.m.wikipedia.org/wiki/N-body_simulation https://en.wikipedia.org/wiki/Celestial_mechanics

J. Barnes & P. Hut (December 1986). "A hierarchical O(N log N) force-calculation algorithm". Nature. 324 (4): 446–449. Bibcode:1986Natur.324..446B. doi:10.1038/324446a0.

Troubleshooting:

https://stackoverflow.com/questions/13316397/matplotlib-animation-no-moviewriters-available https://stackoverflow.com/questions/47736457/runtimeerror-no-moviewriters-available-in-matplotlib-animation?rq=1

Metadata

Release files for CrudeBHT 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for CrudeBHT 1.0.7
File Size Uploaded Provenance Actions
CrudeBHT-1.0.7.tar.gz 7.6 kB Without provenance Details for CrudeBHT-1.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for CrudeBHT 1.0.7
File Interpreter ABI Platform Actions
CrudeBHT-1.0.7-py3-none-any.whl Python 3 none any Details for CrudeBHT-1.0.7-py3-none-any.whl

Total release size: 25.0 kB

Release files / CrudeBHT-1.0.7.tar.gz

Download URL CrudeBHT-1.0.7.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
00c56ba3262b1d1ef5cdb3188aeb912dcb07fda959399c1ed15ab5f653ac29b4
BLAKE2b-256 checksum
How to use checksums
e9943c16d75ccebb9e0d04fca6539eb71c54021a16a933226b440d013178445d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release files / CrudeBHT-1.0.7-py3-none-any.whl

Download URL CrudeBHT-1.0.7-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92b2235d1b072df6e370d534e6a4ed01fa32940a6decd569b8d0b906f50e8c5f
BLAKE2b-256 checksum
How to use checksums
20d721ed53d36b446611f30228ad6bef3450a66a14482070ea688ccda9af5972
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Security for CrudeBHT 1.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page