https://github.com/lbirkert/three-body-problem
a three-body physics simulation written in python
https://github.com/lbirkert/three-body-problem
physics python simulation three-body-problem three-body-simulation
Last synced: 2 months ago
JSON representation
a three-body physics simulation written in python
- Host: GitHub
- URL: https://github.com/lbirkert/three-body-problem
- Owner: lbirkert
- License: mit
- Created: 2024-07-17T20:26:37.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-07-17T20:39:23.000Z (11 months ago)
- Last Synced: 2024-07-18T00:47:48.450Z (11 months ago)
- Topics: physics, python, simulation, three-body-problem, three-body-simulation
- Language: Python
- Homepage:
- Size: 7.42 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
`## 3-Body Problem ##`
[
](demos/vid.mp4)
This one simulates the socalled three body problem,
which describes the unpredictability (due to chaos) of
newtons laws being applied to three bodies, which are strongly
sensitive to the initial starting conditions. The only
external library it uses is pygame, all others are built into
python itself.----
`## Running ##`
1. Make sure you have a new-ish version of pygame installed.
`$ pip install pygame`2. Run the program. This will open up a new pygame window
simulating newtons laws on three bodies. The initial conditions
are defined in the reset function in main.py.
`$ python main.py`3. Try different starting conditions. You can find them in the
reset function in main.py.
```py
def reset():
global objects
objects = []
# try changing some of these numbers
# mass,position,velocity
objects.append(Object(60, (-25, 0), (0, -1)))
objects.append(Object(100, (20, 0), (0, 0)))
objects.append(Object(80, (0, 30), (3, 0)))
```4. Hack it. The project is licensed under the MIT License and you
can find a copy in the LICENSE file.5. Contribute. Have made great new changes? Feel free to PR.
----
© 2024 Lucas Birkert - All Rights Reserved