% TABLE2_20 Computations for Table 2.20.
%
f1='                        x=%4.2f\n';
f2=' nu0=%4.0f  nu=%4.0f\n';
f3='%10.3e %10.3e %10.3e %10.3e %10.3e\n';
f4='%10.3e %43.3e\n';
n=9; iopt=1; numax=4000; eps0=1e-6; err=zeros(n,n+1);
for x=[0 .2 .4 .6 .8 .9 .99]
  ab=r_jacobi(numax+1);
  ab1=ab(2:numax+1,:);
  ab1(1,2)=1/6;
  nu0=round(.75*numax);
  [E,w,nu0,nu]=SPHT(n,x,iopt,ab1,nu0,numax,eps0);
  exact=1/((log((1+x)/(1-x)))^2+pi^2);
  for k=2:2:n+1
    for m=1:n+2-k
      err(m,k)=abs(E(m,k)-exact);
    end
  end
  fprintf('\n')
  fprintf(f1,x)
  fprintf(f2,nu0,nu)
  fprintf('\n')
  if x==0
    for m=1:9
      fprintf(f3,err(m,2),err(m,4),err(m,6),err(m,8),...
      err(m,10))
    end
  else
    fprintf(f4,err(9,2),err(1,10))
  end
end
