# 780.20: 1094 Session 16

Handouts: printout of deltashell_boundstates.cpp, LAPACK fortran routine documentation

In this session, we'll consider the bound-state Schrodinger equation in momentum space, which takes the form of an integral equation.

• Finish any interesting (to you!) parts of Session 15.
• Fill out the SET course evaluation.
• Look at an example of solving an integral equation, which is a momentum-space bound-state problem, using fortran library routines (from LAPACK) and the C++ "new" and "delete" functions

## SET's: Course Evaluations

Thank you in advance for your comments, which are invaluable in planning future versions of this computational physics course. Some things I'd appreciate comments on:

1. Please comment on the pace: too fast, too slow, not enough depth?
2. Do the background notes work? (Do you need them further in advance?)
3. Any topics you would omit? Any ones you would spend more time on? Any topics not covered you think should be covered?
4. Do you think I should choose a text to go along with the course, even if we don't follow it closely? (Suggestions?)
5. Would it be better to introduce C++ classes from the beginning?
6. If you had a choice between computational physics courses taught entirely with Mathematica, entirely with C++, or entirely with Matlab, which would you choose? Or do you think a mix is more useful?
7. As always, suggestions for improvements to any aspect of the course would be appreciated.

## Bound States in Momentum Space: Delta-Shell Potential

As discussed in the background notes, the bound-state Schrodinger equation in momentum space can be solved as a matrix eigenvalue problem. But because the matrix to be diagonalized is NOT symmetric, we can't use the (limited) gsl routines. So we'll use LAPACK, a fortran library, as an exercise in calling fortran routines from C++. We'll also dynamically allocate the one- and two-dimensional arrays using "new" and "delete".

The delta-shell potential is a convenient choice for a test potential because we can find the eigenvalues analytically and it takes a simple form in momentum space. It has only one bound state; if we only print out the negative-energy (E<0) eigenvalues then we should find just one. See the background notes for additional details.

1. What are the units of lambda in the delta-shell potential? [Note: hbar=1 here.]

2. For mu=0.5, b=2.0, and lambda=-1.0, use Mathematica to find the correct eigenvalue for the (single) bound state in the delta-shell potential by using the appropriate equation in the background notes. [Hint: FindRoot] What is the answer?

3. Look at deltashell_boundstates.cpp. Compare the prototype declaration for the fortran routine dgeev to the documentation for dgeev.f (both are given on printouts) to see how they match up. Read the notes in the documentation at the beginning of the deltashell_boundstates.cpp code. Questions?

4. Note how all but one of the arrays (the exception is Eigvec_left) are dynamically allocated and removed using "new" and "delete". Matrices are allocated using double pointers; note the construction. However, to pass them to the fortran routine, we've "flattened" them into single arrays (see how Hmat_passed is formed from Hmat). What does flattening mean?

5. Compile, link, and run deltashell_boundstates.cpp. Look at the makefile to see what libraries are linked. The "-lg2c" is essential when using g++ but easy to overlook. Run with lambda=-1.0 but specify on your own the number of gauss points to use and the upper bound for the integrations of momentum. The latter may be much larger than you would guess because the delta-shell potential is actually rather poorly behaved in momentum space! Based on how the potential falls off with k, what do you think is a reasonable momentum cutoff? (What should you do to discover how the potential falls off?)

6. Run the code with different numbers of gauss points and different momentum cutoffs to try to improve the predicted eigenvalue. Estimate the precision of your best value for the bound-state energy. How could you improve the numerical accuracy of the calculation? (For example, would it help to change "job" when calling "gauss"? [Hint, hint.])

7. What does the momentum-space wave-function look like (it is printed out to a file)?
• Does it fall off at large k? Does it oscillate? Is it well behaved at the origin? Can you account for its characteristics by some simple arguments?

• The analytic wave function in coordinate space is given in the background notes. Try to calculate the momentum space wave function from this (as discussed in the notes) using Mathematica.
• Is the momentum wave function normalized? What is the normalization condition?

8. Bonus: Verify that, regardless of the potential's strength, there is only a single bound state.
9. Bonus: Modify the code to calculate the l=1 bound state.