Code covered by the BSD License  

Highlights from
LaguerreEig

image thumbnail
from LaguerreEig by Damian Trif
Calculates numerical eigenvalues and eigenfunctions of Schroedinger problems on (0,infinity).

laguer(a, x)
function p = laguer(a, x)
%  http://dip.sun.ac.za/~weideman/research/mfiles/laguer.m
%  The function p = laguer(a,x) evaluates a Laguerre polynomial
%  expansion with coefficients a at the values x, by using Clenshaw's
%  algorithm.   The vector x could be a scalar or vector, and the
%  coefficients in the vector a are ordered in increasing order of
%  the index.  

N = length(a)-1;

unp1  =  zeros(size(x));
un    =  a(N+1)*ones(size(x));

for n =  N:-1:1
unm1  =  (1/n)*(2*n-1-x).*un-n/(n+1)*unp1+a(n);
unp1  =  un;  un  =  unm1;
end

p = unm1;
p=p.*exp(-x/2);

Contact us at files@mathworks.com