Computational Methods I
USOS
This is the mandatory Computational Methods I course of the Master in Theoretical Physics at the University of Wrocław. It is tailored towards master and PhD students who are familiar with
- computers and their operating systems (Linux is preferred, but Windows or MacOS will work, too)
- at least one programming language, ideally Python which we will use in the course
- classical and quantum mechanics.
There are many good books on the subject, four that I like are
- Landau , Páez, Bordeianu: Computational Physics: Problem Solving with Python
- Scherer: Computational Physics - Simulation of Classical and Quantum Systems
- Matthes: Python Crash Course - A Hands-On, Project-Based Introduction to Programming
- Johansson: Numerical Python
There will be 2 hours of lectures and 2 hours of labs each week. Please keep in mind that attendance is mandatory and will be checked. Exercises will be posted here at least a week before the lab they are discussed in. Please keep in mind that active participation in the labs and especially submitting the solution to the posed problems is important to pass the course. M.Sc. Hemant Prasad will be the assistant for this course. Please fell free to contact him () or me if you have any questions. For information about credits points, please refer to the syllabus or contact me directly.
Location: We are in the computer lab 120 for both, the lectures and the labs.
Exam: As discussed during the first lecture, we will have individual projects for the exam. If you have any project idea, we are very happy to hear about it and then decide together how to best implement it. Here are a couple of ideas which might help you
- Molecular Dynamics Simulations: Simulate the behavior of a gas or liquid using molecular dynamics. For example implement the Lennard-Jones potential and study properties like diffusion, temperature, or phase transitions.
- Quantum Mechanics Simulations: Solve the Schrödinger equation for a coherent state in the stadium billiard and compare its time evolution with the classical trajectory. Plot some of the eigenfunctions and discuss their properties.
- Monte Carlo Methods: Implement a Monte Carlo simulation of the 2-dimensional Ising model or percolation. Explore random sampling techniques, convergence properties and/or phase transitions.
- Astrophysical Simulations: which is either
- N-body simulations or
- solve the TOV equation
- Electromagnetic Wave Propagation: Model the propagation of electromagnetic waves in various media. Implement the Finite-Difference Time-Domain (FDTD) method to study wave behavior, reflection, and refraction.
- Chaos and Dynamical Systems: Explore chaotic systems, such as the logistic map or Lorenz attractor. Focus: Analyze stability, bifurcations, and strange attractors (other than the Lorenz attractor) using numerical methods.
- Quantum Computing Simulations: Simulate simple quantum algorithms (e.g. Grover's, and Shor's algorithm or quantum teleportation). Implement quantum gates and circuits using Python with libraries such as Qiskit.
Once you have chosen a project and it is approved by us, you will prepare your Python code, a small documentation and some of the most important results and submit them to us by February the 3rd 2026 here on the website in the project section below. It is only possible to submit a single file. If you have multiple files in your project, please combine them to a ZIP-archive. After this, you will have a 15-minute presentation of your results during the exam session (dates and times are also given below) followed by 5 minutes of discussion.
For the last five tutorials, there will be no assignments. Instead you have the chance to discuss problems in the yet open assignment which you have to submit until January the 31st 2024 and challenges you encounter in your project.
Development environment: In this course we will use the programming language Python with a notebook interface, called Jupyter notebooks. To get all this running, and avoid possible problems with incompatible versions of Python packages, we will use a standardized development environment. To set it up, please first install Visual Studio Code. On Linux, you will most likely have it already in your package manager. Alternatively, you can also download it here. Next, you need to clone the git repository for this course. To this end, open VS Code and click on the two documents (Explorer, Ctrl+Shift+E) to find something which looks like this
Now, click on "Clone Repository" and enter the URL of our git repository
https://www.fhassler.de/git/public/ComputationalMethodsI
like this
Finally you have to install all packages for the virtual environment, we use to run our Python code and notebooks. In the main menu, click on Terminal and then Run Build Task... (Ctrl+Shift+B). After this you should see some activity in the terminal on the bottom of the screen. If there are no errors, you have successfully installed the virtual environment. Now you are ready to add your own notebooks or run some of the already provided.
Additional material for the individual lectures, including the exercises which we discuss in the labs, is given below:
Lectures
- A quick introduction to PythonLecture03.10.2025 06:15
- Different representations of numbers and their numerical errorsLecture10.10.2025 06:30
- Numerical differentiation and integrationLecture17.10.2025 06:30
I have updated the virtual environment to include the libraries scipy and sympy. You can just pull the most recent version from the git and run the build task again (like described above) to be able to use these libraries.
- Ordinary differential equationsLecture24.10.2025 06:30
- Classical dynamics with regular and chaotic behaviorLecture31.10.2025 07:30
You might be interested to see a real, physical double pendulum after this lecture. Moreover you can play with the corresponding Poincare-map.
- Methods to solve non-linear equationsLecture07.11.2025 07:30
- Iteration, bifurcation, self-similarity and chaosLecture21.11.2025 07:30
- Linear algebra, in particular finding eigenvalues and eigenvectorsLecture28.11.2025 07:30
- Quantum dynamics, tunneling in a double-well potentialLecture05.12.2025 07:30
- Generating random numbersLecture12.12.2025 09:15
- Langevin and Brownian dynamicsLecture19.12.2025 07:30
There are some nice examples of Langevin dynamics simulations on this website for the harmonic oscillator and for the double well potential, we already encounter in the computation of tunneling rates.
- Monte-Carlo simulationsLecture09.01.2026 07:30
- The two dimensional Ising modelLecture16.01.2026 07:30
- Partial differential equationsLecture23.01.2026 07:30
- Neural networksLecture30.01.2026 07:30, digit_recognition_cnn.py
The attached python implements the CNN for the digit recognition. It is a slight modification of the one given it this repository. You can add a test sample in the file test_image.png. Before runnig it, you have to install tensorflow and matplotlib. The repo for the course contains the respective virtual environment. Note that tensorflow will not work with the most recent (3.13) version of python. You have to use 3.12, which can be down with pyenv.