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. Exercises will be posted here 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. Biplab Mahato 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: There has been a change of the lecture room. We are now in the computer lab 120 for both, the lectures and the labs.
Recordings/hybrid participation: The lectures will be streamed on YouTube with the link for each of them given below. This should help if you are not able to physically attend.
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 2025 here on the website in the project section below. After this, you will have a 10-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 PythonTutorial04.10.2024 08:15, exercise
- Different representations of numbers and their numerical errorsTutorial11.10.2024 08:15, exercise
- Numerical differentiation and integrationTutorial18.10.2024 09:15, exercise
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 equationsTutorial25.10.2024 09:15, exercise
- Classical dynamics with regular and chaotic behaviorTutorial08.11.2024 10:15, exercise
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 equationsTutorial20.11.2024 10:15, exercise
- Iteration, bifurcation, self-similarity and chaosTutorial22.11.2024 10:15, exercise
- Linear algebra, in particular finding eigenvalues and eigenvectorsTutorial29.11.2024 10:15, exercise
- Quantum dynamics, tunneling in a double-well potentialTutorial06.12.2024 10:15, exercise
- Generating random numbers
- Langevin and Brownian dynamics
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 simulations
- The two dimensional Ising modelTutorial17.01.2025 10:15, exercise
- Partial differential equations
- Neural networks
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.
Projects
- Topological Quantum Codes with root lattices, presentation 12.02.2025 12:00, description
Quantum computers are inevitably exposed to numerous errors, so to say decoherence, making quantum error correction indispensable. Among the various error correction methods, the surface code has garnered significant attention as a groundbreaking technique that leverages the relationship between homology and cohomology. I plan to demonstrate a brief simulation of this quantum error correction method using homology and lattice theory(on Qskit and python). Starting with the consideration of codes on a torus, I aim to incorporate discussions on hyperbolic geometry, modular forms, and root lattices.
- Ising Model, presentation 12.02.2025 12:30, description
Last year I studied the ising model but ran into many issues with the code and was un-successful in obtaining a phase transition curve. This time I would like to re-work my code and try to obtain the phase transition curve.
- Quantum Computing Simulations, presentation 12.02.2025 13:00, description
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.I would like to work on quantum circuits that process input data through quantum gates and create entangled states for qubits.
- Exploring Hamiltonian Dynamics in Quantum Teleportation and Shor’s Algorithm in Cryptography with Comparative Analysis Across Classical and Quantum Hardware, presentation 12.02.2025 13:30, description
This project explores the role of Hamiltonian dynamics in quantum teleportation, combined with an analysis of Shor’s algorithm in cryptography, culminating in a comparison of results across classical and quantum computing platforms. The objectives are:
- Hamiltonian Dynamics in Quantum Teleportation:
- Simulate quantum teleportation for three or more qubits, applying Hamiltonians (e.g., free evolution, Ising, Pauli-Z) to analyze their impact on teleportation fidelity.
- Use Qiskit’s tools to implement time evolution of quantum states under the influence of different Hamiltonians and study changes in energy eigenvalues and eigenstates during the teleportation process.
- Shor’s Algorithm in Cryptography:
- Simulate Shor’s algorithm using Qiskit to factorize small integers, demonstrating its potential for breaking RSA encryption.
- Comparative Testing:
- Test simulations on personal computer and accessible quantum hardware.
- Compare results, runtime, and accuracy between classical and quantum platforms, evaluating the advantages and limitations of current quantum computers.
- Extra Challenge (Optional):
- Implement Quantum teleportation and Shor’s algorithm from scratch, to further analyze the results across both systems and deepen understanding of the quantum computing methods.
- Sunspot time series analysis and prediction using deep learning, presentation 12.02.2025 14:00, description
This project focuses on analyzing and predicting solar activity through sunspot numbers using machine learning techniques. The project use the historical sunspot dataset containing monthly mean total sunspot numbers. I expect visual analysis of historical sunspot patterns and trends
- Calculation of flow tortuosity from velocity distribution function, presentation 12.02.2025 14:30, description
In the ordinary way, we calculate the tortuosity of flow by simulating the trajectory of random particles in it. This method is time and resources costly. My main objective in the project will be examination if exist a method which allows us to calculate tortuosity from velocity distribution function (VDF) by random walks. Approach like that could be way much efficient.
- CFD LBMTau1 solver comparison, presentation 12.02.2025 15:00, description
For this project I would like to develop very similar script solving CFD using LBMTau1 method. I would prepare script in Python and C++, solve some static flow problems (ex. driven cavity, Couette problem) end compare results and solution time between two scripts.
Beside presenting the numerical solutions to flow problems, I expect to show discrepecencies in the calculation time between two languages. Solution are expected to be the same. Beside solving physical problem I would like to touch a bit on programming languages, discuss the source of differences between them etc.
- Solution of Navier-Stokes equation using Physics-Informed Neural Network, presentation 12.02.2025 15:30, description
The Navier-Stokes equation is a core concept in modern computational fluid dynamics. There are well-known classical algorithms, such as the Lattice Boltzmann Method, that help us study complex structures. The latest advancements in artificial intelligence show how we can combine underlying differential equations with neural network architectures. In this project, I would like to compare the solutions of the Lattice Boltzmann Method with Physics-Informed Neural Networks (PINNs). Moreover, I want to explore the possibilities of optimizing computations required for both the classical CFD algorithm and the neural network approach.
- Simulate a 2-body system; Earth and moon’s orbit, presentation 13.02.2025 12:30, description
I would like to study the gravitational forces between a 2-body system, the earth and moon’s orbit. I’ll simulate the motion using python and visualize the motion by plotting trajectories and present it using an animation.
- Black Hole imaging using ray tracing, presentation 13.02.2025 13:00, description
The aim of the project is to produce an "image" of a black hole (or rather the effect of gravitational lensing near such an object). We use a ray tracing method in which photon paths are not trivial (we are forced to do so due to strongly curved spacetime near the BH). Those are calculated by using the Runge-Kutta method to solve the geodesic equations.
- Simulations of Celestial Body Motion, presentation 13.02.2025 13:30, description
In my project, I aim to present simulations of celestial body motion. These could include multiple star systems or planetary systems. The program will allow users to customize the parameters of the central body, primarily its mass and size, as well as the orbital parameters of the orbiting bodies.
- Asteroid collisions in an asteroid belt, presentation 13.02.2025 14:00, description
I would like to simulate the growth/destruction of an asteroid in an asteroid belt based on the rabbit population problem. For example, if the asteroid collides with a smaller one, then its mass increases. Otherwise - when it collides with a larger asteroid - it looses a part of its mass. If it's possible I would like to use real data, but if it's too complicated I would set the masses of asteroids randomly. The result would show a growth/destruction chart and also ideally a simulation of the movement of asteroids.
- Molecular Dynamics Simulations, presentation 13.02.2025 14:30, description
Using Lennard-Jones potential to simulate phase transitions and structure under strong/extreme pressure.
- Solution of the TOV equation, presentation 13.02.2025 15:00, description
I will be writing a python code to solve the TOV equation. Subsequently, I shall be plotting the Mass Vs radius plot for a star I considered. I plan to execute the code for one EoS but if I manage to obtain access to other EoS, I'll put forward results for each of them. It will be nice as the results can be compared then. Finally, I'll be analyzing the plot(s).
- Quantum Mechanical Billiards, presentation 13.02.2025 15:30, description
I want to study firstly what changes when going from classical to quantum billiard balls at an intuitive level. Then, I want to get idea about some technical details like to understand how these paths interfere, which make this situation different from classical billiards. Thirdly, I want to see (if possible) how the system changes when "refree observes" the game. And fourth is that does the system become chaotic at any particular energy scale ?