function cpb6_2_9 ( )
%
%  Reference:
%
%    Ward Cheney & David Kincaid
%    Numerical Mathematics and Computing, Fifth Edition
%    Brooks/Cole Publishing Company, 2003.
%

% evaluate test integrals
% Computer Problem 6.2.9
%
  format long

%CPb 6.2.8c (cont.)

  A = quad ( @(x)sin(x).*(x.^(-3)), 1, pi, 1.e-12);
  B = quad ( @(x)sin(x).*(x+pi).^(-3), 0, pi, 1.e-12);

  n = 10000;
  S = 0;
  for j=1:n
    k = n+1-j;
    a = 2*k*pi;
    b = (2*k+1)*pi;
    c = (2*k+2)*pi;
    u = quad ( @(x)sin(x).*(x.^(-3)),a, b, 1.e-12);
    v = quad ( @(x)sin(x).*(x.^(-3)),b, c, 1.e-12); 
    S = S + u - v;
  end

  S = S + A + B

  return
end
