I was evaluating some integrals and got, as part of the result, a ratio between a number and $\operatorname{erf}(c1^{c2} c3)-\operatorname{erf}(c1^{-c2} c3)$

Unfortunately, $c1^{c2} c3$ is a large number and so this difference becomes $0$, giving me a ratio of $c4/0$.

If I separately evaluate the integrals numerically, I can get the correct result, but this makes everything very slow...

Is there a way to force Mathematica to evaluate Erf in a different way? Is there a nice approximation of Erf for very large and very small numbers?


1 Answer 1


In such a case, this is what the two-argument form of Erf[] is intended for:

With[{p = N[2*^3], q = N[1*^2]}, {Erf[q] - Erf[p], Erf[p, q]}]
   {0., -6.40596142491748*10^-4346}

Similar "arbitrary limits" functionality is also available for special functions like Gamma[], GammaRegularized[], Beta[], BetaRegularized[], MarcumQ[]...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.