Python in space, the N body problem - Daniel Jilg

Tags: pycon, python

(One of my summaries of a talk at the 2017 conference).

Daniel Jilg starts off with a picture of a celestial body (=sun, planets) movements with a geocentric worldview. When you put the earth in the center, the movements of the planets are hard to map.

When you put the sun in the center, the movements make more sense. Circular movements or, as Keppler improved, elliptical movements.

Newton improved on it with his law of gravity. Now the movements can be calculated. You can even look at the current planets’ movements and look at the small incongruences. Would an extra planet, a long way off, fix those incongruences? Calculate it and start pointing your telescope. They’re apparently in the pointing-your-telescope phase for some “planet nine” now.

Once the number of celestial bodies gets higher, the calculus gets harder and takes longer. You can express that with the “big O notation”. O: Order of magnitude.

If you have a loop over all bodies inside a loop over all bodies…. you get n^2. That gets out of hand quite quickly.

There’s an algorithm that can do better. n log(n), which is much less worse than n^2. The algorithm places the bodies in a “tree”. Bodies that are farther away can be grouped together with an average location and mass. You now have a much reduced number of calculations.

He showed this Barnes-Hut algorithm visually. “Quad trees”: splitting up the area in quarters until there’s only one celestial body left in a subarea.

(Very good visual presentation/explanation, but impossible to write down :-) )

Photo explanation: simply a picture from my train trip (with a nice planned detour through the Eifel) from Utrecht (NL) to Karlsruhe (DE). Three ICE train heads in Köln Hauptbahnhof. logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):