%SQUAD_INERFC Symbolic analotue of quad_inerfc.m
%
function y=squad_inerfc(dig,N,n,x)
global ab 
digits(dig); x=vpa(x);
uv=sgauss(dig,N,ab); u=uv(:,1); v=uv(:,2);
if subs(x)>=0
  y0=sum(v.*u.^n.*exp(-2*x*u));
  y=2*exp(-x^2)*y0/(sqrt(vpa(pi))*gamma(vpa(n+1)));
else
  y0=sum(v.*u.^n.*exp(-(x^2+2*x*u)));
  y=2*y0/(sqrt(vpa(pi))*gamma(vpa(n+1)));
end
