% EXAMPLE3_45 Routine used in Example 3.45.
%
%    Example 3.45 is computed using the multidomain Stieltjes
%    algorithm if iopt=1, and the multidomain modified Chebyshev
%    algorithm, otherwise. Timings are provided for both algorithms.
%
f1='%10.0f %15.10f %15.10f %15.10f\n';
fprintf('\n')
disp('                             Example3.45')
fprintf('\n')
disp('         n         c=1            c=10          c=100')
iopt=0;
N=80; abp=[];
tic
  for c=[1 10 100]
    abm=r_jacobi(2*N-1);
    ab1=abm(1:N,:); ab1(1,2)=2*c;
    ab2=r_jacobi(N,-.5);
    abmd=[ab1 ab2];
    if iopt==1
      ab=r_multidomain_sti(N,abmd);
    else
      ab=r_multidomain_cheb(N,abmd,abm);
    end
    abp=[abp ab(:,2)];
  end
t=toc;
for n=[1 2 6 13 26 52 80]
  fprintf(f1,n-1,abp(n,1),abp(n,2),abp(n,3))
end
fprintf('\n')
fprintf('        The elapsed time for iopt=%1.0f is %6.3f',iopt,t)
