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_ode_succapprox(n,dom,kind)
```function [x,solnum]=ibvp_ode_succapprox(n,dom,kind)
% solves nonlinear initial/boundary value problems for a general ode
% using the successive approximation method
% x is the Chebyshev grid, solnum is the numerical solution
%
tic;
A=zeros(n);b=zeros(n,1);y=zeros(n,1);
x=pd(n,dom,kind);X=mult(n,dom);D=deriv(n,dom);
myDElin;myINIT;cont=1;dy(cont)=1;
while dy(cont) > 1.e-12
if cont>100, break, end;
cont=cont+1;myDEnonlin;
sol=A\b;dy(cont)=norm(sol-y);y=sol;% the solution in spectral form
end
toc;
solnum = t2x(sol,kind);% the solution in physical form
myOUT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function myDElin
% describes the linear part of the differential equation
% describes the type of the initial/boundary conditions
% must be written by the user
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function myDEnonlin
% describes the nonlinear part of the differential equation
% describes the boundary conditions
% 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```