% TESTMKLT Test of modified KL-transform
%
f1='%8.2f %17.9e %17.9e %10.2e %10.2e %4.0f %4.0f %4.0f\n';
eps0=.5e-10;
fprintf('eps0=%12.4e\n',eps0)
disp('     b           Fr                Fi            err        eri      ni   n2   n3')
global a lambda 
for a=0;
  for lambda=.5;
    for b=[.2 .5 1 4 7 10 15]
      nu=.5+b*i;
      [Fr,Fi,n1,n2,n3]=KLT(@fKL,@K0f,nu,eps0);
%
% exact answers
%
      exr=.5*pi*cosh(a*b)/(cos(a/2)*cosh(pi*b));
      if a>0
        exi=.5*pi*sinh(a*b)/(sin(a/2)*cosh(pi*b));
      else
        exi=pi*b/cosh(pi*b);
      end
%      g=abs(exp(2*mfun('lnGAMMA',lambda+.5+b*i)));
%      exr=sqrt(pi)*g/(2^(lambda+1)*gamma(lambda+.5));
%      exi=sqrt(pi)*b*g/(2^(lambda+1)*gamma(lambda+1.5));
%      K=macdonald(a,0,b);
%      exr=sqrt(pi/2)*K/cosh(pi*b);
%      exi=sqrt(2*pi)*b*K/(a*cosh(pi*b));
%      exr=(.5*pi/sqrt(2))/(cosh(.5*pi*b)*cosh(pi*b));
%      exr=.5*pi^2/((cosh(pi*b))^2);
%      exi=.5*pi^2*sinh(pi*b)/((cosh(pi*b))^2);
      err=abs(Fr-exr);
      eri=abs(Fi-exi);
      fprintf(f1,b,Fr,Fi,err,eri,n1,n2,n3)
    end
  end
end
