Re: Finding the inverf



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
.



Relevant Pages

  • Re: the error function
    ... Edgar ... I like the error function because it is difficult to calculate on computer, ... it tends to blowup in some areas. ...
    (sci.math)
  • Re: Assign a generic name to a function based on user decision
    ... The CDF approximation is straightforward, ... of ERF (and being an approximation to the extent that ERF is an ... the error function! ...
    (comp.lang.fortran)
  • Re: Help with Integral
    ... I found an approximation for the integral ... error function erf/i. ... By playing a little with Raymonds expression fI found a result ... Maybe this sum can be calculated by a recursive reduction ...
    (sci.math)
  • Re: Symmetric rational approximations of the surface area of an ellipsoid
    ... > A remarkable approximation for the surface area of an ellipsoid is ... But if, as I suspect, the maxima of |relative error| would not be ... be symmetric extreme-perfect rational approximations which are ...
    (sci.math)
  • Re: erf function in C
    ... > probability) as part of their math libraries? ... * guarantee the error is less than one ulp for erf. ... we use rational approximation to approximate ... * Coefficients for approximation to erf in ...
    (comp.lang.c)