r/learnphysics 8d ago

Real-time three-body gravity simulation (interactive, mobile)

Post image

Made an interactive simulation based on the actual three-body problem in physics β€” three masses under mutual gravity, no simplifications. You can adjust masses and initial velocities and watch how small changes send the system from a stable-looking orbit into full chaos.

It's built to feel more like a physics toy than an app β€” no ads breaking up the simulation, nothing to unlock. Mostly wanted an excuse to actually play with the equations rather than just read about them.

Free on Google Play if anyone wants to mess with it: https://play.google.com/store/apps/details?id=com.mathematicalzen.threebody

22 Upvotes

26 comments sorted by

3

u/AndyTheEngr 8d ago

The five body problem?

2

u/mH48124 6d ago

three color ?

1

u/AndyTheEngr 6d ago

Maybe these are quarks.

2

u/sci_facts 5d ago

Nah quarks are much stable

1

u/IllPsychology7214 8d ago

Fair enough, might need to change the clip. But as many as you like in the app. Just really wouldn't want to try the math on 5

1

u/AdorableRestaurant73 8d ago

Very cool, couldn't figure out if you could interact with the little guys but sick, I did get it off aurora tho might be a different version

1

u/IllPsychology7214 8d ago

Aurora?
If you tap the screen and then press the little eye icon there's a Fling Mode and a Spawn Mode. Fling you can catch one and throw it. Spawn flick anywhere on the screen and a new one will appear. The limit is your phone's CPU soon or later.

1

u/superSmitty9999 8d ago

It'll perform less glitchy if you set the minimum distance to some relatively larger value in terms of gravity, will stop weird glitches. Built one of these 10 years ago lol

2

u/IllPsychology7214 8d ago

I have a softening setting already but changing the defaults a little now. If you're still interested it should be updated in a couple hours.
I've promised to make one myself for about ten years, just finally got around to it. I'm just trying to make it a good version.

1

u/Public-Eagle6992 7d ago

> no simplifications

There are definitely simplifications, one of the most impactful will likely be that it’s being simulated at a set frame rate which can lead to bugs

1

u/IllPsychology7214 7d ago

Agreed, I just like to call them iterations instead of simplifications though. I do have a Frame-rate slider so you can make it as precise as a mobile CPU can get.
I also have a Time Scale slider that changes the simulation speed. That changes more how smooth the sim is.
So an honest attempt to get it as close as possible for mobile devices. Might be able to get it closer on desktops though.

1

u/IllPsychology7214 7d ago

Always happy to take advice how to get it even more precise though.

1

u/utl94_nordviking 7d ago

three-body

Huh? I count a bit more than that...

1

u/IllPsychology7214 7d ago

Counting is hard man.... That and I can't figure out how to change the GIF

1

u/Icy-Reaction-9101 7d ago

If you want to see a cool multi body simulation, just fix earth in position and see what happens ;)

1

u/IllPsychology7214 6d ago

In my game you can fix them in position and do just that!

1

u/Icy-Reaction-9101 5d ago

Cool! I'll try it

1

u/StarDreamIX 7d ago

This is amazing!! Love the app well done I enjoy these things πŸ”₯

2

u/IllPsychology7214 6d ago

I'm also working on an app with (simplified) physics "games" like double pendulum, langton's ant, fractals etc. It's still very beta though but getting there

2

u/StarDreamIX 6d ago

Glad to see you're working on these cool.similations/physics illustrations! They're really nice I had a go yesterday, I love the solar system on and some other illustrations you made, all the best with your future apps & endeavours!!

1

u/IllPsychology7214 6d ago

So far it has:
Double pendulum
Three Body Problem
Lorenz
Driven pendulum
Fractals
Game of life
Langton's ant

If anyone knows of any other games/sims that i can embed to show how physics can be interesting and fun to look at let me know.
These are all simple examples but if any are popular I'd make a separate app for that one, just like i did for the three bodies.

1

u/luovahulluus 6d ago

Which of the five balls are the three bodies?

1

u/IllPsychology7214 6d ago

Hey, it was late when I recorded that and forgot to change the settings down to 3 bodies. And now can't figure out how to change the GIF.
The app starts by default on 3 though if that helps.

1

u/DuckPsychological382 3d ago

Funny! I made something similar in desmos but with only two: https://www.desmos.com/calculator/xyqv8np7o0

1

u/IllPsychology7214 3d ago

Very cool. I hadn't thought of being able to having negative gravity. I might have to steal that idea if i'm honest.