208
16 Hermite Polynomials
with a small quantum number, it is more efficient to work with the polynomial
representation:
...
% computation only with unique values
[XpYu, iXpYa, iXpYc] = unique(XpY);
[XmYu, iXmYa, iXmYc] = unique(XmY);
% because the degree should be small and we need only
% one single eigenstate we will use hermitepoly
[obj, Hpoly] = hermitepoly(n, 1);
%
HXpY = polyval(Hpoly,XpYu);
HXmY = polyval(Hpoly,XmYu);
...
The Anharmonic Oscillator
A weak additional potential V (x) to the harmonic oscillator ˆ
H 0 naturally raises the
question: What would be the effect on the harmonic oscillator eigensolution? To
approximately study this Hamiltonian system
ˆ
H = ˆ
H 0 + V (x)
(16.24)
we compute the potential matrix V m,n = =m|V |n, with |n a harmonic
oscillator eigenstate. By interpreting V as matrix function x → V (x)
the first step is to evaluate e.g., with the SPECFUNPHYS function
[x,E0]=xoscmatrix(ndim) which lives in the private directory. 1 “ndim” is
the dimension of the matrix, thus a positive integer number equal to or greater than
1. The output arguments are the x-matrix “x” and the diagonal matrix “E0” with the
harmonic oscillator eigenvalues. The MATLAB function Vnm = funm(x,V)
evaluates the function “V” at the square matrix “x”. Thus, the approximate
eigensolutions of ˆ
H are given by computing the eigensolutions of the matrix
E0 + Vnm with the MATLAB function eig or eigs.
As an example we study ˆ
H = ˆ
H 0 +
1
4 sin(π x), via the SPECFUNPHYS function [En, vn, wellfunah] = oscperex(ndim, nmax), with “ndim”
the matrix dimension, “nmax” the number of eigenfunctions for visualization. The
output arguments are the eigenvalues “En”, the eigenvectors “vn”, and nmax wave
functions in coordinate representation “wellfunah”. Please note, this example is
using the MATLAB function eig because the Hamiltonian matrix is no longer
sparse; but this does not mean that all computed eigensolutions makes sense.
function [En, Vn, wellfunah] = oscperex(ndim, nmax)
% ndim = 100: Matrix dimension
% nmax number of eigenvectors for visualisation
% nmax = 5
1 Functions in private directories are only available to functions or scripts that reside in the parent
folder.
Précédent

- 214/287

Suivant