+ 2

N-body simulations getting started

I am an astrophysics student using python to study galaxies and we sometimes use n-body models in our work. I am fluent in python and know rudimentary c++ and Fortran. I want to learn how to write basic n-body simulations but most material I have found shows the mathematics without direct ways of how it is implemented. Can anyone point me in the write direction?

24th May 2019, 4:55 PM
Steven Gough-Kelly
Steven Gough-Kelly - avatar
1 Réponse
+ 1
If I were you, I would start by create a class body with attribute (mass, position and speed) Then I would create a class Model that would take a list of bodies in its constructor and the delta T between each step. This class would also have a function next_step() that would calculate the new position of all the bodies after delta T using gravity equation Then if I want to see, the evolution in a more graphic way, I would look into these canvas class of tkinter (python) Hope it helps
24th May 2019, 6:32 PM
Paul