MATSLISE: A solver for Schrödinger and Sturm-Liouville equations |
Running MATSLISE at the command line
In some cases it may be interesting to run MATSLISE at the command line,
not using the Graphical User Interface. This page discusses some
of the functions and methods that can be called from the command line directly (or from a Matlab .m
-file).
Before the methods discussed below can be called, the MATSLISE directory
and its subdirectories must be added to the search path. This can be done using the Set Path-dialog from the Matlab
File
-menu or using the Matlab command addpath
.
A Schrödinger object is created by:
sch = schrod(V,a,b,a0,b0,a1,b1)
sch = schrod(V,a,b,a0,b0,a1,b1,var)
where V
is a string representing the potential function. The double precision constants
a,b,a0,b0,a1,b1
specify the integration interval and the boundary conditions. It is allowed
to enter inf/-inf
for the two input parameters a
and b
. Good
truncated endpoints are then determined automatically for every eigenvalue. If there are
less then eight input arguments, then the independent variable is supposed to be x
,
otherwise the independent variable is the character or string in var
and V
is then V(var)
. The method schrod(...)
is the constructor of the class schrod
.
In a very analogous manner a Sturm-Liouville equation is specified:
sl = slp(p,q,w,a,b,a0,b0,a1,b1)
sl = slp(p,q,w,a,b,a0,b0,a1,b1,var)
where p,q
and w
are strings representing the coefficient
functions p(x),q(x)
and w(x)
(or p(var)
, q(var)
and w(var)
) and the double precision numbers a,b,a0,b0,a1,b1
are the endpoints of the integration interval and the coefficients of the boundary conditions.
Again inf
-values are allowed for a
and b
.
An object representing an equation with a distorted Coulomb potential is produced by
d = distorted_coulomb(l,S,R,xmax)
d = distorted_coulomb(l,S,R,xmax,var)
where S
and R
are two strings (representing S(x)
and R(x)
) and the orbital quantum number l
is a double. xmax
is the x
-value
where the integration interval is truncated. When xmax
is equal to inf
a good truncation point is
automatically determined for every requested eigenvalue.
After the problem is specified, the user can call one of the classes which implement the actual
Piecewise Perturbation algorithms included in MATSLISE (cpm12_10, cpm14_12, cpm16_14
or lpm10
) e.g.:
cp = cpm16_14(schrod,tol)
cp = cpm16_14(slp,tol)
cp = cpm16_14(distorted_coulomb,tol)
or
lp = lpm10(schrod,tol)
lp = lpm10(slp,tol)
lp = lpm10(distorted_coulomb,tol)
with tol
a positive constant representing the accuracy requested
in the results. These function-calls start the construction of the partition. This partition and some related information
is returned in the output argument (cp
or lp
).
In this stage the eigenvalues, in a range fixed by the user, are calculated.
The user starts the calculation by calling a method from the ppm
class:
E = get_eigenvalues(pp_child,pmin,pmax)
E = get_eigenvalues(pp_child,pmin,pmax,indices)
[E,pp_child] = get_eigenvalues(pp_child,pmin,pmax,indices) %(for infinite problems)
where pp_child
is an instance of one of the child classes of the
cpm
class or lpm
class(i.e. the output argument cp
or lp
from the previous section).
If indices
is true
, the eigenvalues E_k (k=0,1,...)
with indices k
between pmin
and pmax
are calculated;
if indices
is false
or omitted the eigenvalues in the range
[pmin,pmax
] are calculated.
The method returns a structure E
, in which all information related to the
calculated eigenvalue(s) is stored. The fields E.eigenvalues
,
E.indices
and E.errors
are three vectors.
E.eigenvalues
contains the calculated eigenvalues in ascending order.
The associated indices are collected in E.indices
and E.errors
holds an estimation of the error for each eigenvalue.
The field E.success
is false when the PP method was not able to obtain
the data due to an error, e.g. when there is no eigenvalue in the interval
[pmin,pmax
].
In some cases a warning is generated in the method get_eigenvalues
:
e.g. when two eigenvalues are so close that double precision accuracy is not
sufficient to differentiate between them adequately.
Another method in the ppm
class which is visible to the user,
is the method which allows the calculation of the eigenfunction associated with a
certain eigenvalue e
:
V = get_eigenfunction(pp_child,e)
V = get_eigenfunction(pp_child,e,n)
V = get_eigenfunction(pp_child,e,ap,bp,n)
where again pp_child
is an instance of one of the child classes of
ppm
.
To obtain a good approximation for the eigenfunction the eigenvalue e
must
be sufficiently accurate (e.g. by choosing a small value for tol
).
If n
is omitted, then the eigenfunction is evaluated only in
the meshpoints of the partition.
If n
> 0, then the interval [ap,bp
] is taken and further
partitioned in n
intervals. On these intervals the additional
potential-dependent expressions are calculated and the propagation matrix algorithm
is applied to produce the eigenfunction. Only the part of the eigenfunction corresponding
with the n+1
points in [ap,bp
] is returned.
When the input-arguments ap
and bp
are omitted, then the
whole interval [a,b
] is considered.
The structure V
has three fields: the three vectors V.x
,
V.y
and V.yprime
of which the meaning is clear.
The ppm
class contains one more function accessible for users: the plot_partiton
function. It can
be called as follows:
plot_partition(pp_child)
where pp_child
is again an instance of the cpm12_10, cpm14_12, cpm16_14
or lpm10
class.
The plot_partition
function makes a plot of the partition: i.e. of the meshpoints and the reference potential.
plot_partition
, for the Mathieu equation solved by the CPM{12,10} method with tol=10^(-10).Some properties of an object defined in MATSLISE can be accessed using the get-method of the form get(object_name,'property_name')
.
Some properties of a schrodinger problem which can be obtained in this way are e.g.: V
(the potential function),
min
and max
(the endpoints of the integration interval). But maybe the most interesting one is infostring
which returns a string containing information on the classification of a problem. This classification information
is obtained using the classification algorithm for Sturm-Liouville problems by C. Fulton, S. Pruess and Y. Xie.
sch = schrod('x^2',0,inf,1,0,1,0);
get(sch,'infostring')
The spectrum is simple, purely discrete and bounded below.
There is no continuous spectrum.
At endpoint A
The problem is regular.
At endpoint B
The problem is singular.
It is nonoscillatory for all eigenvalues.
It is limit point.
The Friedrichs boundary conditions are 1y(b)+ 0y'(b)=0
This classification information can also be obtained for a distorted-Coulomb or a Sturm-Liouville object.
Some examplesThe MATSLISE examples
-directory contains some example .m
files. These examples illustrate the use
of the functions discussed above to solve a Schrodinger or Sturm-Liouville problem, i.e. to calculate the eigenvalues and eigenfunctions.