% SR_HRHERMITE  This computes the first N 
%    recurrence coefficients alpha_k, beta_k, k=0,1, 
%    . . . ,N-1, to an accuracy of nofdig digits for 
%    the system of half-range Hermite polynomials 
%    orthogonal with respect to the weight function 
%           w(x)=exp(-x^2)  on R_{+}. 
%    The output variable ab is the Nx2 array of the 
%    nofdig-digit recurrence coefficients, and dig is 
%    the number of digits required to achieve this 
%    target precision. 
%
function [ab,dig]=sr_hrhermmite(N,dig0,nofdig)
tic
dd=10;
i=dig0-dd; 
maxerr=1;
while maxerr>.5*10^(-nofdig)
  i=i+dd; dig=i;
  mom=momhrhermite(dig,N);
  if i==dig0
    ab0=schebyshev(dig,N,mom);
  else
    ab1=schebyshev(dig,N,mom);
    serr=abs((ab1-ab0)./ab1);
    err=subs(serr);
    maxerr=max(max(err)); 
    ab0=ab1;
  end
end
ab=vpa(ab1,nofdig);
toc
