Universitäts-Sternwarte München

Fakultät für Physik der Ludwig-Maximilians-Universität


Gravitational dynamics tutorials
Summer semester 2023

Klaus Dolag, Rhea-Silvia Remus, Tadziu Hoffmann

Tutorials overview

In this class you will be required to write small computer programs to solve physical problems. This will be done incrementally in small steps, so if you have only little programming experience to date you will have the opportunity to pick this up. (Like all important skills, this will require serious effort and lots of experimentation from your side. Do not underestimate the work required for this course.) But keep in mind that programming is not the main aspect of these tutorials — understanding physics is.

Each of the tutorials will involve a general discussion about the goals of the current exercise set and the related physical and numerical issues. Preparation for the exercises and participation in the discussions will be mandatory. The tutorials will also give you the opportunity to discuss particular programming aspects. Do not be afraid to ask questions, out of a mistaken belief that this will make you appear stupid in front of your peers (who are often less knowledgeable than they would like you to believe). If you become stuck in your programming efforts, we will provide example code fragments that demonstrate how to perform certain computational tasks.


Your grade in this course will be based on:

  • Your contributions to the discussions in the tutorials.
  • One page of plots and/or data tables for each tutorial from T1 to T11, to be handed in at the beginning of the following tutorial, that shows the results of your numerical calculations for the tutorial. Creating clear, comprehensible plots is a skill you must learn, and the quality and expressiveness of your plots will affect your grade.
  • A written Hausarbeit with a maximum of 4 pages (A4, at least 2 cm margin on all sides, at least 11 pt font) to be handed in at the end of the semester. For this Hausarbeit, for one tutorial of your choice from T4 through T11, you must provide an extended analysis of an aspect of the subject of your own design that goes well beyond the general questions we pose as part of the tutorial content. Don’t choose a topic based on whether you think it will be easy, but rather choose one that appeals to your curiosity and allows for experimentation. Your analysis of the problem should demonstrate a deeper insight into the physics involved.


You will need a laptop computer with:

  • a C/C++ or Fortran compiler (e.g., gcc or gfortran or the Intel oneAPI toolkit),*
  • a text editor (such as emacs or vim),
  • a program to produce graphs (for example, gnuplot).

You can also do your calculations (remotely, via ssh) on the computers of the LMU Physik CIP Pool.

Tutorial T0 is intended to give you the chance to set up your programming environment and gain some experience in using the command-line tools we will be employing during this course.
Use this opportunity to ask us questions if you need help in setting up your system.

(*While theoretically the algorithms we will use can be programmed in any programming language, scripting languages such as Python do not have the required performance for the larger problems we will tackle later in this course. Since the tutorials are designed to allow you to incrementally grow your programs, you will benefit most by starting with a compiled language from the very beginning of the course. We offer assistance with C/C++ and Fortran (and gnuplot and IDL for plotting). If you are undecided: what language should I choose?)

Tutorial session times

Monday, 16:00–18:00 (+ open end for help with programming issues).

Tutorial schedule

Tutorial numberContentDate

T0Introduction to the shell and gnuplot 2023-04-17
T1Units and acceleration; first program 2023-04-24

Holiday 2023-05-01
T2Gravitational forces; vectors and loops 2023-05-08
T3Euler integrator 2023-05-15
T4Euler and other integrators 2023-05-22

Holiday 2023-05-29
T5Kepler fitting 2023-06-05
T6Multiple (test) particles and extended potentials 2023-06-12
 T7General 3-body problem (ejection, softening) 2023-06-19
 T8Lagrange points (restricted 3-body problem) 2023-06-26
 T9General N-body problem (free-fall collapse) 2023-07-03
T10Dynamical friction 2023-07-10
T11Colliding galaxies 2023-07-17
T12Visualization of galaxies in cosmological simulations2023-07-24

       = content updated since the tutorial class
       = new tutorial online
Letzte Änderung 08. Juni 2023 15:01 UTC durch Webmaster (webmaster@usm.uni-muenchen.de)