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.

magnitude.m
% Structure and grow rate for entries of D^4 respectively F*D^4*F with F=(E-X^2)^2;
N=zeros(10,1);M=zeros(10,1);MF=zeros(10,1);
for k=1:10
    N(k)=20+10*k;
    E=speye(N(k));X=mult(N(k),[-1,1]);D=deriv(N(k),[-1,1]);
    M(k)=max(max(abs(D^4)));S(k)=nnz(D^4)*100/N(k)^2;
    F=(E-X^2)^2;
    MF(k)=max(max(abs(F*D^4*F)));SF(k)=nnz(F*D^4*F)*100/N(k)^2;
end
figure(1);loglog(N,M,'o',N,MF,'*');xlabel('log(N)');ylabel('log(M)');
legend('D^4','F*D^4*F');grid;
p=(log(M(end))-log(M(1)))/(log(N(end))-log(N(1)));
pF=(log(MF(end))-log(MF(1)))/(log(N(end))-log(N(1)));
disp([p;pF])
n=64;dom=[-1,1];kind=2;E=speye(n);X=mult(n,dom);D=deriv(n,dom);F=(E-X^2)^2;
figure(2);spy(D^4);title('D^4');
figure(3);spy(D^4*F);title('D^4*F');
figure(4);spy(F*D^4*F);title('F*D^4*F');
disp([N,S',SF']);

Contact us