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).

main_fermi
function main_fermi
%
n=128;
[x,w]=pd(n);t=x2t(n,x);
D=deriv(n);X=mult(n);D2=D^2;
Uinit=t'\exp(-x/2);
options=optimset('Display','iter','TolX',1.e-12);
[U,fval] = fsolve(@fermi,Uinit,options);
xx=(0:0.1:5)';txx=x2t(n,xx);
sol=txx'*U;
display([xx,sol]);
plot(xx,sol);grid

function F=fermi(U)
%
F=x.*((t'*(D2*U)).^2)-(t'*U).^3;
F(n)=ones(1,n)*U-1;
end
end

Contact us at files@mathworks.com