Home
 Astrophotos
 Projects
 Python

Martin Sparre

Python

This page contains a selection of teaching material from my MSc university courses on scientific programming in Python taught 2017-2024 at University of Potsdam.

Description: the main aim of this course is to get familiar with programming, especially in the Python programming language. It is well suited for beginners as well as students, who already have programming experience. It is also well suited for physics students, observational astronomers, and theorists specializing in computer simulations. For those who are well familiar with programming there will be “optional bonus exercises” to challenge you. The course contains an optional C tutorial.

Download lecture notes: pdf source

Exercises

Dark matter in a simulated galaxy: BonusExercise2022_DarkMatter.zip (tex source)

Stars in a simulated galaxy: BonusExercise_Stars.zip

Gas in a simulated galaxy: GasInAGalaxy.zip

Plot observed galaxy PlotGalaxy.pdf PlotGalaxy.zip

Numerical integration: NumericalIntegration.pdf NumericalIntegration.tex

Astropy exercise: Astropy.pdf

Toomre model exercise and codes Toomre_Exercise.pdf Toomre_Codes.zip ComputerExercise_Toomre.zip

Nbody examples and exercises: NbodySim.pdf NbodyExamples.zip Source_NbodySim.zip

Monte Carlo calculation of pi: PiExercise.pdf 2024_ExerciseA.zip PiExercise.tex

C tutorial and slides: C-Slides.pdf C.zip