%Code 10: tanh-rule for 2nd kind improper integrals (-1,+1)
% Input: n: #abscissas ; (a,b): integration domain
%        c: tanh-scaling factor 
% Output: I_n(f) 
function In = qtanh(a,b,n,c,fun)  
  h = c/sqrt(n); u = [-n:n]*h/2;
  f = feval(fun,(b-a)*.5*(tanh(u)+1)+a) ;
  In = (b-a)*(.25*h)*sum(f./(cosh(u).^2));

