We will continue to use the same ``setup.m'' to initialize the basic variables needed for the spectral method. As this part of the setup is fully general, no changes need be made to ``setup.m''. For this problem we will use the same parameters as for the Poisson solution, S=[20; 25; 30]; R=diag([6 6 6]). Before proceeding, double check that you have the same values for these parameters set at the top of ``setup.m''.
Next, create a new file ``sch.m'' where we will place our solution to
Schrödinger's equation. Begin by setting the variable V to the
sample values of a simple harmonic oscillator potential of frequency
,
To verify your result, cut and paste the file ``viewmid.m'' from
Appendix A, run your ``sch.m'' and then enter the
command ``viewmid(V,S);''. The function viewmid(V,S) will draw mesh
plots of your potential as viewed in planes slicing through the center
of the cell, which in this case should yield parabolic surfaces with
minima in the center of each plane and maxima of approximately 35.
Hint: You may borrow your computation of dr from your ``poisson.m''.
Because it is always the combination
from Eq. (1)
which appears in expressions, it is most convenient to compute this
``dual'' representation once and then export it as a global variable.
Include a statement at the top of ``sch.m'' declaring gbl_Vdual as a
global variable, and set its value by including the statement
gbl_Vdual=cJdag(O(cJ(V)));immediately after your computation of V.
Tomas Arias 2004-04-23