% EXAMPLE2_34 Computation for Example 2.34.
%
%    At the bottom of the routine quadgp.m, the weight
%    function wf has to be specified as follows:
%                  y=exp(-x.*x);
%
clear mc uv AB
global mc uv AB
eps0=.5e-14;
mc=3; exact=sqrt(pi)/2;
AB=[[0 1.013];[1.013 3.639];[3.639 Inf]];
n=5; int=0;
while(abs(int-exact)>eps0)
  sm=0;
  uv=fejer(n);
  for i=1:3
    xw=quadgp(n,i);
    sm=sm+sum(xw(:,2));
  end
  int=sm;
  n=n+1;
end 
n
int
err=abs(int-exact)
mc=1; AB=[0 Inf]; i=1;
uv=fejer(22);
xw=quadgp(22,i);
sm=sum(xw(:,2));
int=sm
err=abs(int-exact)
uv=fejer(66);
xw=quadgp(66,i);
sm=sum(xw(:,2));
int=sm
err=abs(int-exact)
