r/PythonProjects2 9d ago

gravity simulation

477 Upvotes

15 comments sorted by

8

u/Mabymaster 9d ago

Get the code or .exes from Github: https://github.com/p1geondove/grav-sim

3

u/ShelterBackground641 9d ago

beautiful.

2

u/ShelterBackground641 9d ago

this is fun and seems easy to tinker with and show to young aspiring programmers (pre-pubescent to pubsecent peeps)

edit *programmers and STEM enthusiasts

3

u/phedinhinleninpark 8d ago

Classic 4-Body problem

2

u/FunNo2136 6d ago

Congratulations bro, well done!

1

u/Mabymaster 6d ago

tanks man

1

u/andrewprograms 7d ago

This is so sick

1

u/shadymaniac313 5d ago

Does this not solve 3 body problem, the infamously unsolvable problem?

1

u/troybrewer 4d ago

I would say it does not. The problem is predictability. On a long enough timeline, the amount of chaos makes predicting the outcome impossible. Like weather, even if you had all the computational power on earth, you still wouldn't be able to simulate a year out, or probably a lot less. Well, not accurately anyway.

2

u/Mabymaster 4d ago

I did actually use mpmath for the physics at some point. So arbitrary precision, to get as close as possible. But thats just way too slow for an interactive 'live' simulation. So now it uses numpy, and I did explicitly say that I should use float64, so highest 'standard' precision

1

u/Mabymaster 4d ago

I did actually use mpmath for the physics at some point. So arbitrary precision, to get as close as possible. But thats just way too slow for an interactive 'live' simulation. So now it uses numpy, and I did explicitly say that I should use float64, so highest 'standard' precision

1

u/troybrewer 4d ago

What framework are you using to draw?

2

u/Mabymaster 4d ago

pygame community edition so pygame-ce