3
$\begingroup$

Is it possible to evaluate Erf[200] with arbitrary precision? I only get 1. as result but I would like to know if a arbitrary precision is possible because I need to compare a gaussian approximation to the hypergeometric distribution that for the values I'm using results in $\approx 10^{-6100}$.

Should I instead rely on NIntegrate and specify directly there my precision?

$\endgroup$
7
$\begingroup$

For large arguments, is it not better to use Erfc?

For example:

myErf[z_, prec_:$MachinePrecision] := 1 - N[Erfc[z], prec];

myErf[200]
(* -> 0.9999999999999999...9999999999999531064070401639850196 *)

This also has the advantage of not requiring involved calculations at very high precision, allowing the answer to be produced almost immediately.

$\endgroup$
2
$\begingroup$

How about

1 - N[1 - Erf[200], 20]
(* 0.99999999999 <<17371 more 9s>> 99999999999531064070401639850196 *)

In version 9:

We can exploit the two argument Erf: Erf[z1] - Erf[z2] == Erf[z2, z1].

1 - N[Erf[200, \[Infinity]], 20]
(* 0.99999999999 <<17371 more 9s>> 99999999999531064070401639850196 *)
$\endgroup$
  • $\begingroup$ My mathematica gives N::meprec: Internal precision limit $MaxExtraPrecision = 50. reached while evaluating 1-Erf[200]. >> and as result 1.00000000000000000000000000000000000000000000000000000000000000000000\ 0 $\endgroup$ – linello Apr 10 '14 at 15:21
  • $\begingroup$ Whoops, I'm not in version 9 right now. I'll update... $\endgroup$ – Chip Hurst Apr 10 '14 at 15:24
1
$\begingroup$

I'm not sure whether this gives the correct answer, but you could use RealDigits with a high setting of $MaxExtraPrecision to get your answer. Since it is almost 1, we subtract Erf[200] from 1 to get a number close to zero and add later:

Block[{$MaxExtraPrecision = 100000},
 RealDigits[1 - Erf[200], 10, 10]
 ]
(* {{4, 6, 8, 9, 3, 5, 9, 2, 9, 5}, -17374} *)

and then maybe

FromDigits[%]+1//Short
(* (200000000000000<<17353>>0000000937871859)/(200000000000000<<17353>>0000000000000000) *)

to get an exact rational expression.

$\endgroup$
0
$\begingroup$

Not sure if this helps: $MaxExtraPrecision=4999
f[x_]:=-x^2-Log[Pi]/2-Log[x]-1/(2x^2)+5/(8x^4)-37/(24x^6)

N[f[20],24] equals -403.569343334317232747174
N[Log[1-Erf[20]],24] equals -403.569343334104234962969

and N[Log[1-Erf[200]],24] returns Indeterminate but f[200] yields -40005.8706948090821358531
For what it's worth: Series[Log[1 - Erf[x]], {x, \[Infinity], 3}].

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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