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.

[x,solnum]=ibvp_int_succapprox(n,dom,kind)
```function [x,solnum]=ibvp_int_succapprox(n,dom,kind)
% solves nonlinear Volterra integral equations of the type
% y(x)=f(x)+int_0^x K(x,t)N(y) dt, x in [0,L]
% using successive approximation method
%
tic;
x=pd(n,dom,kind);[Vspec,Vphys]=volt(n,dom,kind);
yo=zeros(n,1);myINIT;dy=1;cont=1;
while dy(cont) > 1.e-12
if cont>100, break, end;
cont=cont+1;
F=myfun(x);yn=F+Vphys*N(yo);
dy(cont)=norm(yn-yo);yo=yn;
end;
toc;solnum = yn;myOUT;
function [Vspec,Vphys]=volt(n,dom,kind)
% Volterra operator with kernel K(x,t)
T=cpv(n,x,dom);[J,J0]=prim(n,dom);
V=T*J0/T;
[YY,XX]=meshgrid(x,x);KW=mykernel(XX,YY);
Vphys=V.*KW;Vspec=T\Vphys*T;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function col=mykernel(x,t)
% x scalar, t column vector, y column vector of coefficients
% calculates the kernel K(x,t)
% must be written by the user
end
function f=myfun(x)
% calculates the function f(x) in physical space
% must be written by the user
end
function myINIT
% describes the initial approximation in spectral form
% must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function myOUT
% describes the output of the code
% must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end```