% TEST_GRADAU_RADAU Test of generalized Gauss_Radau for r=1 against Radau
%
f1='%5.0f %10.2e %10.2e %10.2e %10.2e %10.2e %10.2e\n';
errxleg=zeros(100,1); errwleg=zeros(100,1);
errxcheb=zeros(100,1); errwcheb=zeros(100,1);
errxlag=zeros(100,1); errwlag=zeros(100,1);
disp('                            maximum errors for r=1')
disp('             Legendre              Chebyshev             Laguerre')
disp('   N      errx       errx       errx       errw       errx       errw')
for N=[1:5 10:5:40 60:20:100]
  r=1;
%
% Legendre measure
%
  endl=-1;
  ab=r_jacobi(N+r);
  xw=gradau(N,ab,r,endl);
  xw0=radau(N,ab,endl);
  errxleg(N)=max(abs(xw(:,1)-xw0(:,1)));
  errwleg(N)=max(abs((xw(:,2)-xw0(:,2))./xw(:,2)));
%
% Chebyshev measure
%
  ab=r_jacobi(N+r,-.5);
  xw=gradau(N,ab,r,endl);
  xw0=radau(N,ab,endl);
  errxcheb(N)=max(abs(xw(:,1)-xw0(:,1)));
  errwcheb(N)=max(abs((xw(:,2)-xw0(:,2))./xw(:,2)));
%
% Laguerre measure
%
  endl=0;
  ab=r_laguerre(N+r);
  xw=gradau(N,ab,r,endl);
  xw0=radau(N,ab,endl);
  errxlag(N)=max(abs(xw(:,1)-xw0(:,1)));
  errwlag(N)=max(abs((xw(:,2)-xw0(:,2))./xw(:,2)));
end
for N=[1:5 10:5:20 40:20:100]
  fprintf(f1,N,errxleg(N),errwleg(N),errxcheb(N),errwcheb(N),...
    errxlag(N),errwlag(N))
end
