Code covered by the BSD License

# Chebpack

### Damian Trif (view profile)

15 Jul 2011 (Updated )

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

[c,cor,kod]=lisc(Nfun,lam,phi,phip,xleg,rleg,wleg,errtol,m,cinit)
```function [c,cor,kod]=lisc(Nfun,lam,phi,phip,xleg,rleg,wleg,errtol,m,cinit)
%
% Lyapunov-Schmidt reduction
%
c0=zeros(size(lam));t=cputime;
if nargin==10,
c0(1:length(cinit))=cinit;cor=zeros(25,1);
end
for j=1:25
[c,rez,drez,kod]=as(Nfun,lam,phi,phip,xleg,rleg,wleg,c0,m,errtol);%k=1;
if kod==-2, disp('No convergence in fixed point iterations; increase m or change c0');break;end
if kod==-1, disp('Slow convergence in fixed point iterations; increase m');break;end
if m==0, k=0;break;end;
difc=-drez\rez;cor(j)=norm(difc);
if cor(j)<10*errtol, break;end
if (j>3 && cor(j)>=cor(j-1) && cor(j-1)>=cor(j-2))
kod=-4;disp('No convergence in Newton iterations; change c0');
return
end
c0=c;c0(1:m)=c0(1:m)+difc(1:m);
end
%disp([num2str(k*j),' Newton iterations computed by lisc in ',num2str(cputime-t),' sec']);
if m~=0,disp(['last correction = ',num2str(cor(j))]);end
if j==25
disp('Slow convergence in Newton iterations');kod=-3;
return;
end
if (kod<0), return;end```