# Trying to compute erfcx(x)? [duplicate]

The function erfcx(x) = exp(x^2)erfc(x) is sometimes provided in numerical packages to avoid numerical underflow for large values of x. But Mathematica does not provide a native implementation of this function.

Any suggestions as to what can I use to compute $$\exp(x^2)\mathrm{erfc}(x)$$ accurately for large values of $$x$$?

Edit: I just realized this is a duplicate of Numerical underflow for a scaled error function, which contains very detailed answers. So I'm closing this one.

• Underflow rather than Overflow? Jul 18, 2019 at 18:01
• What do you consider large values of $x$? N[Exp[x^2] Erfc[x] /. x -> 1000000, 500] works fine.
– JimB
Jul 18, 2019 at 18:01
• you can also use 2 HermiteH[-1, x]/Sqrt[Pi]. Jul 18, 2019 at 18:07
• @JimB - extreme precision isn't necessary. Even low arbitrary-precision works fine, e.g., N[Exp[x^2] Erfc[x] /. x -> 1000000, 15] Jul 18, 2019 at 18:18
• Do those numerical packages just use the approximation $\frac{1}{\sqrt{\pi } x}$ for $x>10^6$ ?
– JimB
Jul 18, 2019 at 18:18

Using the approximation $$\frac{1}{\sqrt{\pi } x}$$ when $$x>5*10^6$$:
erfcx[x_] := If[x > 5*10^7, 1/(x Sqrt[π]), Exp[x^2] Erfc[x]]