Code covered by the BSD License

# Chebpack

15 Jul 2011 (Updated )

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

% Calculates the coefficients of the primitive F(x) of cos(x), F(0)=0
% c: using the initial value problem
% cc: the coefficients of the exact solution sin(x) for comparison
% ccc: using the integration matrix J
% cccc: using the integration matrix J0
n=16;dom=[0,1];kind=2;x=pd(n,dom,kind);f=x2t(cos(x),kind);
D=deriv(n,dom);T=cpv(n,dom(1),dom);[J,J0]=prim(n,dom);
ct=J*f;id=speye(n);id(1,:)=T;ct(1)=0;ccc=id\ct;
D(end,:)=T;f(end)=0;c=D\f;
cc=x2t(sin(x),kind);
cccc=J0*f;
display([c cc ccc cccc]);