Re: Finding the inverf
- From: David W. Cantrell <DWCantrell@xxxxxxxxxxx>
- Date: 08 Dec 2007 06:11:25 GMT
Raymond Manzoni <raymman@xxxxxxx> wrote:
morgajl@xxxxxxxxx a écrit :
Could someone tell me how to calculate inverf (x) if I am given the
value of erf (x).
See here : http://functions.wolfram.com/GammaBetaErf/InverseErf/
and here :
http://www.theorie.physik.uni-muenchen.de/~serge/erf-approx.pdf
Thank you for mentioning the second reference,
"A handy approximation for the error function and its inverse",
Sergei Winitzki, Jan. 2006.
Below, I make comments about that article, including an important
correction, and I offer small improvements on the approximations.
---------------------------------------------------------
Winitzki's first approximation is for the error function:
For nonnegative x, erf(x) is approximately
sqrt( 1 - exp( -x^2 (pi/4 + a x^2)/(1 + a x^2) ) )
where a = 8/(3pi) (pi - 3)/(4 - pi). The approximation is, as stated,
"correct to better than 4*10^-4 in relative precision". The reader is then
referred to a graph of relative error in the left part of Fig. 1. But two
things about that graph are deceptive. (1) On the vertical scale, not only
are decimal points not visible, but a significant zero is missing. For
example, the top label on that axis should read ".00035" rather than
"0035". (2) The graph might easily give the impression that the
approximation always overestimates erf(x) for positive real x. However,
that is not the case: for x > 5.166..., the approximation slightly
underestimates erf(x).
If our concern is to make worst |relative error| as small as possible, then
we should choose a value for the constant a which is larger that
Winitzki's. Using a = 0.147, we obtain |relative error| < 0.00013 .
---------------------------------------------------------
Winitzki's second approximation is for the inverse of the error function:
For nonnegative x, inverf(x) is approximately
sqrt(-2/(a pi) - log(1 - x^2)/2 + sqrt((2/(a pi) + log(1 - x^2)/2)^2 -
log(1 - x^2)/a))
where, as before, a = 8/(3pi) (pi - 3)/(4 - pi). This approximation was
obtained by inverting the first one. It is then stated that "The relative
precision of this approximation is again better than 4*10^-4, uniformly for
all real x in the interval (0,1), as illustrated in Fig. 1, right." But
that is incorrect; in fact, the worst |relative error| is roughly 3.5*10^-3
instead, and Fig. 1, right, does indicate just that.
As with the first approximation, if our concern is to make
worst |relative error| as small as possible, then we should choose a value
for the constant a which is larger that Winitzki's. Using a = 0.146, we
obtain |relative error| < 0.0022 .
---------------------------------------------------------
Are any readers familiar with "better" approximations for erf or inverf?
David W. Cantrell
.
- References:
- Finding the inverf
- From: morgajl
- Re: Finding the inverf
- From: Raymond Manzoni
- Finding the inverf
- Prev by Date: Re: Non-zero gaps between real numbers
- Next by Date: Re: Derivations on manifolds. J. Lee, p.65
- Previous by thread: Re: Finding the inverf
- Next by thread: Re: Finding the inverf
- Index(es):
Relevant Pages
|