Using Python to create a solar system

If anyone is looking for a fun exercise to flex their fingers…

Using just gravitational attraction between bodies, you can create your own 2D solar system with as many stars and planets as you want. Here’s a binary star system with some relatively stable planets

Here’s the article, including a detailed step-by-step tutorial, if you want to read more: Simulating Orbiting Planets in a Solar System Using Python

…and there’s also a 3D version (next post)

@s_gruppetta this is really awesome! Given that it's for learning the coding side, I won't mark you down for using explicit integration 😜.

It's amazing how dynamic visualization can really solidify complex topics. Even when I've done iterative static computation in the past, dynamically-updating matplotlib plots really helped give me more intuition about the problem I was trying to solve.

@mattkram Yes, I find that I need to focus either on the coding aspect or on the science aspect, but you can’t really do both–the article is already long as it is!

Agreed, in real-world cases, the dynamic aspect adds an extra dimension which can help convey the results, in some cases, of course!

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.