Skip to content

5 steps to N-body simulation

This is a series of tutorials inspired by the course "CFD Python: 12 steps to Navier-Stokes". The goal is to teach beginners how to write fast and clean N-body gravity simulations code in Python.

Although basic knowledge in Python and Calculus is assumed, everything is explained in detail so beginners should be able to follow along. After completing this tutorial, you would be able to write your own N-body simulation code in Python. At the end of the tutorial, you are encouraged to make your own project related to N-body simulation.

How to use this tutorial?

The source code for the python scripts and the markdown files are available on

but I strongly recommend reading this tutorial on our website:

Snippets of the code will be shown as we progress, but you don't have to copy them one by one as the full code is always available at the end of each step. However, I do recommend you to translate it into your own code in order to have a better understanding.

Contents

References

  1. Lorena Barba and Gilbert Forsyth. CFD Python: the 12 steps to Navier-Stokes equations. Journal of Open Source Education, 2(16):21, 2019. doi:10.21105/jose.00021.
  2. Javier Roa, Adrian S. Hamers, Maxwell X. Cai, and Nathan W. C. Leigh. Moving Planets Around: An Introduction to N-Body Simulations Applied to Exoplanetary Systems. MIT Press, 2020.
  3. Richard L. Burden and J. Douglas Faires. Numerical Analysis. Cengage Learning, nineth edition, 2011.

Comments