[Solved] FYS4150 Project2-eigenvalue problems

$25

File Name: FYS4150_Project2-eigenvalue_problems.zip
File Size: 339.12 KB

SKU: [Solved] FYS4150 Project2-eigenvalue problems Category: Tag:
5/5 - (1 vote)

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

u(x)“>u(x)u(x) is the vertical displacement of the beam in the L“>LL, F“>FF is a force applied at γ“> is a constant defined by properties like the rigidity of the beam. We apply again so-called Dirichlet boundary conditions and set γ“>, L“>LL are known. As an example, assume we know L“>LL. Then the eigenvalue problem we set up below will allow us to find ρ=xL,“>=xL,=xL,

meaning that we have d2u(ρ)dρ2=−FL2γu(ρ)=−λu(ρ),“>d2u()d2=FL2u()=u(),d2u()d2=FL2u()=u(),

with u“>uu as we did in project 1, namely

h“>hh is our step. Next we define minimum and maximum values for the variable ρmin=0“>min=0min=0 and N“>NN, we define the step length ρmin=ρ0“>min=0min=0 and h=ρN−ρ0N.“>h=N0N.h=N0N.

The value of i“>ii is then

ρi“>ii as

−ui+1−2ui+ui−1h2=λui.“>ui+12ui+ui1h2=ui.ui+12ui+ui1h2=ui.

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

u0“>u0u0 and d=2/h2“>d=2/h2d=2/h2 and the non-diagonal ones as i=1“>i=1i=1 to λj=d+2acos⁡(jπN),j=1,2,…N−1.“>j=d+2acos(jN),j=1,2,N1.j=d+2acos(jN),j=1,2,N1.

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 vi=[vi1……vin]“>vi=vi1vinvi=[vi1vin]

We assume that the basis is orthogonal, that is

wi=Uvi,“>wi=Uvi,wi=Uvi,

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. N“>NN and use either armadillos or numpys functions for diagonalizing a matrix. You can then check that you obtain the analytical eigenvalues.

For Jacobis method, we define the quantities s=sin⁡θ“>s=sins=sin and cot⁡2θ=τ=all−akk2akl.“>cot2==allakk2akl.cot2==allakk2akl.

We can then define the angle akl“>aklakl become non-zero and we obtain the quadratic equation (using t2+2τt−1=0,“>t2+2t1=0,t2+2t1=0,

resulting in

c“>cc and c=11+t2,“>c=11+t2,c=11+t2,

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 −ℏ22m(1r2ddrr2ddr−l(l+1)r2)R(r)+V(r)R(r)=ER(r).“>22m(1r2ddrr2ddrl(l+1)r2)R(r)+V(r)R(r)=ER(r).22m(1r2ddrr2ddrl(l+1)r2)R(r)+V(r)R(r)=ER(r).

In our case (1/2)kr2“>(1/2)kr2(1/2)kr2 with E“>EE is the energy of the harmonic oscillator in three dimensions. The oscillator frequency is Enl=ℏω(2n+l+32),“>Enl=(2n+l+32),Enl=(2n+l+32),

with l=0,1,2,…“>l=0,1,2,l=0,1,2,.

Since we have made a transformation to spherical coordinates it means that l“>ll is the orbital momentum of the electron. Then we substitute −ℏ22md2dr2u(r)+(V(r)+l(l+1)r2ℏ22m)u(r)=Eu(r).“>22md2dr2u(r)+(V(r)+l(l+1)r222m)u(r)=Eu(r).22md2dr2u(r)+(V(r)+l(l+1)r222m)u(r)=Eu(r).

The boundary conditions are u(∞)=0“>u()=0u()=0.

We introduce a dimensionless variable α“> is a constant with dimension length and get

l=0“>l=0l=0. Inserting −ℏ22mα2d2dρ2u(ρ)+k2α2ρ2u(ρ)=Eu(ρ).“>22m2d2d2u()+k222u()=Eu().22m2d2d2u()+k222u()=Eu().

We multiply thereafter with −d2dρ2u(ρ)+mkℏ2α4ρ2u(ρ)=2mα2ℏ2Eu(ρ).“>d2d2u()+mk242u()=2m22Eu().d2d2u()+mk242u()=2m22Eu().

The constant mkℏ2α4=1,“>mk24=1,mk24=1,

or

λ=2mα2ℏ2E,“>=2m22E,=2m22E,

we can rewrite Schroedingers equation as

l=0“>l=0l=0 are ρ“>, ρmax“>maxmax, respectively. You need to check your results for the energies against different values ρmax=∞“>max=max=.

With a given number of mesh points, h“>hh as, with ρmax=ρN“>max=Nmax=N,

ρ“> at a point ρi=ρ0+ihi=1,2,…,N.“>i=0+ihi=1,2,,N.i=0+ihi=1,2,,N.

We can rewrite the Schroedinger equation for a value −u(ρi+h)−2u(ρi)+u(ρi−h)h2+ρi2u(ρi)=λu(ρi),“>u(i+h)2u(i)+u(ih)h2+2iu(i)=u(i),u(i+h)2u(i)+u(ih)h2+i2u(i)=u(i),

or in a more compact way

Vi=ρi2“>Vi=2iVi=i2 is the harmonic oscillator potential.

We define first the diagonal matrix element

ei=−1h2.“>ei=1h2.ei=1h2.

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

ui“>uiui is unknown. We can write the latter equation as a matrix eigenvalue problem

N“>NN and your approximation to λ=3,7,11,15,…“>=3,7,11,15,=3,7,11,15,. How many integration points do you need in order to reproduce the analytical results with say four leading digits after the decimal point?

You can reuse the code you wrote for part (b), but you need to add the potential −ℏ22md2dr2u(r)+12kr2u(r)=E(1)u(r),“>22md2dr2u(r)+12kr2u(r)=E(1)u(r),22md2dr2u(r)+12kr2u(r)=E(1)u(r),

where (−ℏ22md2dr12−ℏ22md2dr22+12kr12+12kr22)u(r1,r2)=E(2)u(r1,r2).“>(22md2dr2122md2dr22+12kr21+12kr22)u(r1,r2)=E(2)u(r1,r2).(22md2dr1222md2dr22+12kr12+12kr22)u(r1,r2)=E(2)u(r1,r2).

Note that we deal with a two-electron wave function E(2)“>E(2)E(2).

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 R=1/2(r1+r2)“>R=1/2(r1+r2)R=1/2(r1+r2). With these new coordinates, the radial Schroedinger equation reads

r“>rr and u(r,R)=ψ(r)ϕ(R)“>u(r,R)=(r)(R)u(r,R)=(r)(R) and the energy is given by the sum of the relative energy ER“>ERER, that is

V(r1,r2)=βe2|r1−r2|=βe2r,“>V(r1,r2)=e2|r1r2|=e2r,V(r1,r2)=e2|r1r2|=e2r,

with r“>rr-dependent Schroedinger equation becomes

ρ=r/α“>=r/=r/. Repeating the same steps as above, we arrive at

ωr2=14mkℏ2α4,“>2r=14mk24,r2=14mk24,

and fix the constant mαβe2ℏ2=1“>me22=1me22=1

or

λ=mα2ℏ2E,“>=m22E,=m22E,

we can rewrite Schroedingers equation as

ωr“>rr as a parameter which reflects the strength of the oscillator potential.

Here we will study the cases ωr=0.5“>r=0.5r=0.5, ωr=5“>r=5r=5 for the ground state only, that is the lowest-lying state.

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 l=0“>l=0l=0. We omit the center-of-mass energy.

You can reuse the code you wrote for part (b), but you need to add the potential ωr“>rr.

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 ωr“>rr. With no Coulomb interaction you should have a result which corresponds to the non-interacting case. Plot either the function itself or the probability distribution (the function squared) with and without the repulsion between the two electrons. Varying l=0“>l=0l=0 and omit again the center-of-mass motion.

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.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] FYS4150 Project2-eigenvalue problems
$25