The aim of this project is to develop your own code for solving eigenvalue problems. The matrix to diagonalize is the same as the one we encountered in project one, a so-called tridiagonal Toeplitz matrix. This matrix has analytical eigenpairs (eigenvalues and eigenvectors) and gives us an excellent testing ground for our algorithms. In this project we will develop an eigenvalue solver based on Jacobis method. The project will also introduce you to units tests and we will compare our results against other eigenvalue solvers (from LAPACK and/or numpy).
This project aims also at introducing to you the concept of scaling of equations. This means often either making various variables dimensionless or introducing units which are more convenient.
We will start with the two-point boundary value problem of a buckling beam or a spring fastened at both ends. This is one of the problems which has analytical solutions. Thereafter, by simply adding a new variable along the diagonal elements, we can study quantum mechanical problems. In particular, we will study the harmonic oscillator problem in three dimensions, with one or two electrons. For the latter case we can study the role of the repulsive Coulomb interaction and extract interesting physics results. For selected frequencies, this interacting two-electron problem exhibits analytical solutions, one of the few cases of an interacting system where wecan find analytical solutions. See M. Taut, Phys. Rev. A 48, 3561 (1993) for the derivation of analytical expressions for the eigenpairs..
Electrons confined in small areas in semiconductors, so-called quantum dots, form a hot research area in modern solid-state physics, with applications spanning from such diverse fields as quantum nano-medicine to the contruction of quantum gates. The article on quantum computing with quantum dots by Loss and DiVincenzo is an excellent read for those interested in this exciting topic.
The buckling beam problem, a classical wave function problem in one dimension
We start with the following differential equation, namely
meaning that we have
with
The value of
Following our approach from project 1, we can rewrite this equation in a more a general form, but now as an eigenvalue problem, that is
The eigenvectors are
Tom Lyche provide an excellent description of this matrix. Chapters 1.2 and 1.3 of this text present a thourough discussion of tridiagonal matrices and two-point boundary value problems.
Project 2 a): Mathematical intermezzo
A unitary transformation preserves the orthogonality of the obtained eigenvectors. To see this consider first a basis of vectors
We assume that the basis is orthogonal, that is
preserves the dot product and orthogonality.
Project 2 b): Setting up a code for tridiagonal Toeplitz matrix
Your task now is to write a function which implements Jacobis rotation algorithm (see Lecture notes chapter 7) in order to solve Eq.
For Jacobis method, we define the quantities
We can then define the angle
resulting in
and eig$_$sym can be used to find eigenvalues and eigenvectors. A Python program which solves this part of the project is available under the project writing slides.
Comment your results (here you could for example compute the time needed for both algorithms for a given dimensionality of the matrix).
Project 2 c): Implementing tests in your code
In this project (and later ones as well) we will implement so-called unit tests. Our unit tests are mainly meant to test mathematical properties of our algorithm. During the development phase of a program it is useful to devise tests that your program should pass. One of these is to make sure that for a given simple test matrix (say a
In our case
with
Since we have made a transformation to spherical coordinates it means that
The boundary conditions are
We introduce a dimensionless variable
We multiply thereafter with
The constant
or
we can rewrite Schroedingers equation as
With a given number of mesh points,
We can rewrite the Schroedinger equation for a value
or in a more compact way
We define first the diagonal matrix element
In this case the non-diagonal matrix elements are given by a mere constant. All non-diagonal matrix elements are equal. With these definitions the Schroedinger equation takes the following form
You can reuse the code you wrote for part (b), but you need to add the potential
where
Note that we deal with a two-electron wave function
With no interaction this can be written out as the product of two single-electron wave functions, that is we have a solution on closed form.
We introduce the relative coordinate
with
and fix the constant
or
we can rewrite Schroedingers equation as
Here we will study the cases
With no repulsive Coulomb interaction you should get a result which corresponds to the relative energy of a non-interacting system. Make sure your results are stable as functions of
You can reuse the code you wrote for part (b), but you need to add the potential
For specific oscillator frequencies, the above equation has answers in an analytical form, see the article by M. Taut, Phys. Rev. A 48, 3561 (1993).
Project 2 f): First optional exercise: Quantum physics analysis of the results
This exercise is a continuation of the previous and adds more quantum physics to the analysis. In this exercise we want to plot the wave function for two electrons as functions of the relative coordinate
The eigenvectors are normalized. Plot then the normalized wave functions for different values of Barth, Martin and Wilkinson, Numerische Mathematik 9, 386 (1967).
Project 2 h): Third optional challenge: Implementing Lanczos algorithm
This exercise is optional and is meant more as a challenge for those of you with an interest in other algorithms for solving eigenvalue problems. Implement the iterative Lanczos algorithm discussed in the lecture notes and compute the lowest eigenvalues as done in exercise (c) or (d) above. Compare your results and discuss faults and merits of the iterative method versus direct methods like Jacobis method.
Introduction to numerical projects
Here follows a brief recipe and recommendation on how to write a report for each project.
- Give a short description of the nature of the problem and the eventual numerical methods you have used.
- Describe the algorithm you have used and/or developed. Here you may find it convenient to use pseudocoding. In many cases you can describe the algorithm in the program itself.
- Include the source code of your program. Comment your program properly.
- If possible, try to find analytic solutions, or known limits in order to test your program when developing the code.
- Include your results either in figure form or in a table. Remember to label your results. All tables and figures should have relevant captions and labels on the axes.
- Try to evaluate the reliabilty and numerical stability/precision of your results. If possible, include a qualitative and/or quantitative discussion of the numerical stability, eventual loss of precision etc.
- Try to give an interpretation of you results in your answers to the problems.
- Critique: if possible include your comments and reflections about the exercise, whether you felt you learnt something, ideas for improvements and other thoughts youve made when solving the exercise. We wish to keep this course at the interactive level and your comments can help us improve it.
- Try to establish a practice where you log your work at the computerlab. You may find such a logbook very handy at later stages in your work, especially when you dont properly remember what a previous test version of your program did. Here you could also record the time spent on solving the exercise, various algorithms you may have tested or other topics which you feel worthy of mentioning.
Format for electronic delivery of report and programs
The preferred format for the report is a PDF file. You can also use DOC or postscript formats or as an ipython notebook file. As programming language we prefer that you choose between C/C++, Fortran2008 or Python. The following prescription should be followed when preparing the report:
- Use Canvas to hand in your projects, log in at https://www.uio.no/english/services/it/education/canvas/ with your normal UiO username and password.
- Upload only the report file! For the source code file(s) you have developed please provide us with your link to your github domain. The report file should include all of your discussions and a list of the codes you have developed. Do not include library files which are available at the course homepage, unless you have made specific changes to them. Alternatively, you can just upload the address to your GitHub or GitLab repository.
- In your git repository, please include a folder which contains selected results. These can be in the form of output from your code for a selected set of runs and input parameters.
- In this and all later projects, you should include tests (for example unit tests) of your code(s).
- Comments from us on your projects, approval or not, corrections to be made etc can be found under your Canvas domain and are only visible to you and the teachers of the course.
Reviews
There are no reviews yet.