Code covered by the BSD License  

Highlights from
Chebpack

image thumbnail

Chebpack

by

 

15 Jul 2011 (Updated )

The MATLAB package Chebpack solves specific problems for differential or integral equations.

[lamv,phiv,lamu,phiu,x]=Lutzen(n,dom,kind,numeigval)
function [lamv,phiv,lamu,phiu,x]=Lutzen(n,dom,kind,numeigval)
% From: J. LUTZEN, Sturm and Liouville's Work on Ordinary
% Linear Differential Equations. The Emergence of Sturm-Liouville Theory,
% http://www.maths.ed.ac.uk/~aar/papers/lutzen.pdf
%

% -v'''=\lambda v, x in [0,1]     u'''=\lambda u, x in [0,1]
% v(0)=v'(0)=v(1)=0,              u(0)=u(1)=u'(1)=0        
% Call: [lamv,phiv,lamu,phiu,x]=Lutzen(64,[0 1],2,10);
% Verify the biorthogonality of the third derivative eigenfunctions
%
tic;
x=pd(n,dom,kind);X=mult(n,dom);D=deriv(n,dom);E=speye(n);
Fv=X^2*(E-X);Av=-Fv*D^3*Fv;Bv=Fv*Fv;Av=Av(1:n-3,1:n-3);Bv=Bv(1:n-3,1:n-3);
Fu=X*(E-X)^2;Au=Fu*D^3*Fu;Bu=Fu*Fu;Au=Au(1:n-3,1:n-3);Bu=Bu(1:n-3,1:n-3);
[V,Lv]=eig(full(Av),full(Bv));
[LLv,ind]=sort(diag(Lv),'ascend');VV=V(:,ind);
lamv=LLv(1:numeigval);
phiv=t2x(Fv*[VV(:,1:numeigval);zeros(3,numeigval)],kind);
[U,Lu]=eig(full(Au),full(Bu));
[LLu,ind]=sort(diag(Lu),'ascend');UU=U(:,ind);
lamu=LLu(1:numeigval);
phiu=t2x(Fu*[UU(:,1:numeigval);zeros(3,numeigval)],kind);
toc;
[xx,ww]=pd(n,dom,3);
for k=1:numeigval
    fu(:,k) = barycheb(xx,phiu(:,k),x,kind);
    fv(:,k) = barycheb(xx,phiv(:,k),x,kind);
    nu=wip(fv(:,k),fu(:,k),ones(n,1),ww);
    fu(:,k)=fu(:,k)/sqrt(abs(nu));
    fv(:,k)=fv(:,k)/sqrt(abs(nu))*sign(nu);
end
    display([lamu,lamv]);I=wip(fv,fu,ones(n,1),ww);display(I);
    bar3(I)
end

Contact us