User Tools

Site Tools


numexercises7_15

This is an old revision of the document!


Numerical Exercises for Tuesday July 15

In today's exercises, we complete the tasks from yesterday, which unfortunately had ambiguous and confusing instructions!

The easy stuff

  • Install Git, and try out some of the commands covered in Morten or Nicolas's lecture slides (computing.pdf talentdftguides.pdf) for your codes in the following problems.
  • In your favorite programming language, make a program to construct a real symmetric $NxN$ matrix. Diagonalize it using the appropriate LAPACK or GSL routine, and write out some number of the lowest eigenvalues. (Suggestion: You might find it useful to use Mathematica (available on the ECT* computers) to diagonalize a small matrix that you can benchmark against.) This will help you test that you've linked to the GSL or LAPACK library and things are properly installed.

Harmonic Oscillator wf's

  • In the code here, find the subroutine that computes the generalized laguerre polynomials $L_n^{l+1/2}(x)$, “laguerre_general”.

Recall that the HO wavefunctions are given by \begin{equation} R_{nl}(r) = \frac{A_{nl}}{b^{3/2}}x^le^{-x^2/2}L_{n}^{l+1/2}(x^2)\,, \end{equation}

where the oscillator length $b\equiv \sqrt{\hbar/(m\omega)}$, and the dimensionless variable $x\equiv r/b$. The normalization constant is given by

\begin{equation} A_{nl}=\sqrt{\frac{2^{n+l+2}n!}{\pi^{1/2}(2n+2l+1)!!}} \end{equation}

  • Using the uploaded code for guidance, make your own subroutine to calculate $L_{n}^{\alpha}(x)$. Then, using the definition of the HO wf's, make a subroutine/function to calculate $R_{nl}(r)$.
  • As a check on your code, check the orthogonality of the $R_{nl}$,

\begin{equation} \int_{0}^{\infty}R_{nl}(r)R_{n'l}(r)r^2dr= \delta_{nn'} \end{equation}

  • As discussed in the HO notes, the “best” type of Gaussian quadrature over HO wf's is Gauss-Laguerre. However, as you see in the code here, you can use Gauss-Legendre as well. (Note: there are plenty of freely downloadable Gauss-Legendre subroutines.) In this way, the orthogonality check takes the form

\begin{equation} \int_{0}^{\infty}R_{nl}(r)R_{n'l}(r)r^2dr\approx \sum_{i=1}^{N}w_i r_i^2 R_{nl}(r_i)R_{n'l}(r_i)\,, \end{equation}

where the sum is over the N mesh points and $w_{i}$ are the quadrature weights.

numexercises7_15.1405403016.txt.gz · Last modified: 2014/07/15 01:43 by bogner