% KERNEL Gauss remainder kernels.
%
%    Given a weight function w(t) through the first numax 
%    recurrence coefficients ab of its orthogonal polynomials,
%    [ker,nu]=KERNEL(N,ab,z,eps0,nu0,numax) generates to a 
%    relative accuracy eps0 the first N+1 Gauss remainder kernels 
%    for w, i.e., the ratios (int p_k(t)w(t)dt/(z-t))/p_k(z),
%    k=0,1,...,N, where p_k is the polynomial of degree k
%    orthogonal relative to the weight function w. The numerators
%    of these ratios are generated by the routine cauchy, and the
%    denominators by the three-term recurrence relation for the 
%    p_k. The integers nu0, numax, nu have the same meaning as in
%    the routine cauchy. The alpha- and beta-coefficients of the
%    given weight function are to be provided in the first and 
%    second column of the numax x 2 input array ab; the kernels 
%    are stored in the (n+1)x1 output array ker.
%
%    See also CAUCHY.
%
function [ker,nu]=kernel(N,ab,z,eps0,nu0,numax)
[ker,r,nu]=cauchy(N,ab,z,eps0,nu0,numax);
p0=0; p=1;
for n=1:N
  pm1=p0; p0=p;
  p=(z-ab(n,1))*p0-ab(n,2)*pm1;
  ker(n+1)=ker(n+1)/p
end
