Inverse of the Error Function
Univ.-Prof. Dr.-Ing. habil. J. BETTEN
RWTH University Aachen
Mathematical Models in Materials Science and Continuum Mechanics
Augustinerbach 4 - 22
D-52064 A a c h e n / Germany
betten@mmw.rwth-aachen.de
Abstract
Forming the inverse of the GAUSS error function erf(x) a best approximation to erf(x) has
been discussed, the inverse of which can easily be determined.
The deviation between the error function and its best approximation has been calculated
by considering the L-two error norm.
Keywords: Best approximation; approximant; inverse; L-two error norm
Introduction
As has been explained by BETTEN (2005) in more detail the creep behavior of several materials
can be interpreted as a diffusion controlled process. Calculating this process we need the inverse
of the error function.
The GAUSS error function is implied in the Maple software as a standard function.
An approximation of its inverse is discussed in the following.
Best Approximation
An approximation to the error function erf(xi) on [0,r] is assumed by the hyperbolic tangent:
> |
approximant:=tanh(a*xi); |
 |
(2.1) |
This function is suitable because it is similar to erf(xi). Furthermore, the inverse can easily be determined:
> |
inverse:=(1/a)*arctanh(xi); |
 |
(2.2) |
Note that the Area Tangent, artanh(...), is indicated as arctanh(...) in MAPLE. The best approximation by the hyperbolic tangent is guaranteed by an optimal parameter a which minimizes the L-two error norm:
> |
L_two[0..r]:=sqrt((1/r)*int((erf(xi)-tanh(a*xi))^2, xi=0..r))=minimum; |
![`:=`(L_two[0 .. r], `*`(`^`(`+`(`*`(`/`(1, `*`(r)), `*`(int(`*`(`^`(`+`(erf(xi), `-`(tanh(`*`(a, `*`(xi))))), 2)), xi = 0 .. r)))), `/`(1, 2))) = minimum)](/view.aspx?SI=5525/Worksheet_293_4.gif) |
(2.3) |
Thus, the derivative of the integral should be equal to zero.
> |
derivative[0..r]:=diff(int((erf(xi)-tanh(a*xi))^2, xi=0..r),a); |
![`:=`(derivative[0 .. r], int(`+`(`-`(`*`(2, `*`(`+`(erf(xi), `-`(tanh(`*`(a, `*`(xi))))), `*`(`+`(1, `-`(`*`(`^`(tanh(`*`(a, `*`(xi))), 2)))), `*`(xi)))))), xi = 0 .. r))](/view.aspx?SI=5525/Worksheet_293_5.gif) |
(2.4) |
Depending on the range [0, r] considered, we obtain the following optimal parameters:
> |
for r in [1,2,3,4,5,infinity] do
a[optimal][0..r]:= fsolve(int(xi*(erf(xi)-tanh(a_*xi))*(1-(tanh(a_*xi))^2), xi=0..r)=0,a_)
od; |
![`:=`(a[optimal][0 .. 1], 1.172868316)](/view.aspx?SI=5525/Worksheet_293_6.gif) |
(2.5) |
![`:=`(a[optimal][0 .. 2], 1.201270935)](/view.aspx?SI=5525/Worksheet_293_7.gif) |
(2.5) |
![`:=`(a[optimal][0 .. 3], 1.202760580)](/view.aspx?SI=5525/Worksheet_293_8.gif) |
(2.5) |
![`:=`(a[optimal][0 .. 4], 1.202782281)](/view.aspx?SI=5525/Worksheet_293_9.gif) |
(2.5) |
![`:=`(a[optimal][0 .. 5], 1.202782515)](/view.aspx?SI=5525/Worksheet_293_10.gif) |
(2.5) |
![`:=`(a[optimal][0 .. infinity], 1.202782517)](/view.aspx?SI=5525/Worksheet_293_11.gif) |
(2.5) |
The corresponding L-two error norms are given as:
> |
for r in [1,2,3,4,5,infinity] do
L_two[0..r]:=evalf(sqrt((1/r)*int((erf(xi)-tanh(a[optimal][0..r]*xi))^2,xi=0..r)))
od; |
![`:=`(L_two[0 .. 1], 0.8219954058e-2)](/view.aspx?SI=5525/Worksheet_293_12.gif) |
(2.6) |
![`:=`(L_two[0 .. 2], 0.1428838030e-1)](/view.aspx?SI=5525/Worksheet_293_13.gif) |
(2.6) |
![`:=`(L_two[0 .. 3], 0.1216051374e-1)](/view.aspx?SI=5525/Worksheet_293_14.gif) |
(2.6) |
![`:=`(L_two[0 .. 4], 0.1053649880e-1)](/view.aspx?SI=5525/Worksheet_293_15.gif) |
(2.6) |
![`:=`(L_two[0 .. 5], 0.9424169402e-2)](/view.aspx?SI=5525/Worksheet_293_16.gif) |
(2.6) |
![`:=`(L_two[0 .. infinity], 0.)](/view.aspx?SI=5525/Worksheet_293_17.gif) |
(2.6) |
Inverse Functions
Depending on the range [0, r] we obtain the following inverse functions:
> |
for r in [1,2,3,4,5,infinity] do
inverse[0..r]:=(1/a[optimal][0..r])*arctanh(xi)
od; |
![`:=`(inverse[0 .. 1], `+`(`*`(.8526106353, `*`(arctanh(xi)))))](/view.aspx?SI=5525/Worksheet_293_18.gif) |
(3.1) |
![`:=`(inverse[0 .. 2], `+`(`*`(.8324516734, `*`(arctanh(xi)))))](/view.aspx?SI=5525/Worksheet_293_19.gif) |
(3.1) |
![`:=`(inverse[0 .. 3], `+`(`*`(.8314206640, `*`(arctanh(xi)))))](/view.aspx?SI=5525/Worksheet_293_20.gif) |
(3.1) |
![`:=`(inverse[0 .. 4], `+`(`*`(.8314056632, `*`(arctanh(xi)))))](/view.aspx?SI=5525/Worksheet_293_21.gif) |
(3.1) |
![`:=`(inverse[0 .. 5], `+`(`*`(.8314055014, `*`(arctanh(xi)))))](/view.aspx?SI=5525/Worksheet_293_22.gif) |
(3.1) |
![`:=`(inverse[0 .. infinity], `+`(`*`(.8314055001, `*`(arctanh(xi)))))](/view.aspx?SI=5525/Worksheet_293_23.gif) |
(3.1) |
Examples
In the following some examples should be plotted:
> |
alias(H=Heaviside,th=thickness): |
> |
plot({1,H(xi-2),erf(xi),tanh(a[optimal][0..2]*xi)}, xi=0..2.001,color=black); |
> |
Delta(xi):=erf(xi)-tanh(a[optimal][0..2]*xi); |
 |
(4.1) |
> |
for i from 1 to 3 do
zero[i-1]:=fsolve(Delta(xi)=0,xi,(i-1)/2..i/2)
od; |
![`:=`(zero[0], 0.)](/view.aspx?SI=5525/Worksheet_293_26.gif) |
(4.2) |
![`:=`(zero[1], .8439158081)](/view.aspx?SI=5525/Worksheet_293_27.gif) |
(4.2) |
![`:=`(zero[2], fsolve(`+`(erf(xi), `-`(tanh(`+`(`*`(1.201270935, `*`(xi)))))) = 0, xi, 1 .. `/`(3, 2)))](/view.aspx?SI=5525/Worksheet_293_28.gif) |
(4.2) |
> |
plot1:=plot({-0.02,0.02,0.02*H(xi-2),-0.02*H(xi-2)}, xi=0..2.001,color=black): |
> |
plot2:=plot(Delta(xi),xi=0..2,color=black,th=3, title="deviation between erf(xi) and tanh(a*xi) on [0, 2]"): |
> |
plots[display]({plot1,plot2}); |
> |
L_two[0..2]:=sqrt((1/2)*Int((Delta)^2,xi=0..2))= evalf(sqrt((1/2)*int((Delta(xi))^2,xi=0..2))); |
![`:=`(L_two[0 .. 2], `+`(`*`(`/`(1, 2), `*`(`*`(`^`(2, `/`(1, 2)), `*`(`^`(Int(`*`(`^`(Delta, 2)), xi = 0 .. 2), `/`(1, 2))))))) = 0.1428838030e-1)](/view.aspx?SI=5525/Worksheet_293_30.gif) |
(4.3) |
> |
for i in [1.18,1.19,a[optimal][0..2],1.21,1.22] do
L_two[i]:=evalf(sqrt((1/2)*int((erf(xi)-tanh(i*xi))^2, xi=0..2)))
od; |
![`:=`(L_two[1.18], 0.1529807823e-1)](/view.aspx?SI=5525/Worksheet_293_31.gif) |
(4.4) |
![`:=`(L_two[1.19], 0.1457543612e-1)](/view.aspx?SI=5525/Worksheet_293_32.gif) |
(4.4) |
![`:=`(L_two[1.201270935], 0.1428838030e-1)](/view.aspx?SI=5525/Worksheet_293_33.gif) |
(4.4) |
![`:=`(L_two[1.21], 0.1445712660e-1)](/view.aspx?SI=5525/Worksheet_293_34.gif) |
(4.4) |
![`:=`(L_two[1.22], 0.1504066478e-1)](/view.aspx?SI=5525/Worksheet_293_35.gif) |
(4.4) |
For the value a =1.201270935 the L-two error norm is minimal in the range xi = [0, 2]. The following Figures illustrate the error function erf(xi) and some inverse approximations (1/a)*arctanh(xi):
> |
plot1:=plot({1,xi,H(xi-1)}, xi=0..1.001,scaling=constrained,color=black): |
> |
plot2:=plot({erf(xi),(1/a[optimal][0..1])*arctanh(xi)}, xi=0..1,0..1,scaling=constrained,color=black,th=2): |
> |
plots[display]({plot1,plot2}); |
> |
plot1:=plot({1,2,xi,2*H(xi-2),2*H(xi-1),-2*H(xi-1.002)}, xi=0..2.001,scaling=constrained,color=black): |
> |
plot2:=plot({erf(xi),(1/a[optimal][0..2])*arctanh(xi)}, xi=0..2,0..2,color=black,th=2): |
> |
plots[display]({plot1,plot2}); |
> |
plot1:=plot({1,5,xi,5*H(xi-5),5*H(xi-1),-5*H(xi-1.002)}, xi=0..5.001,scaling=constrained,color=black): |
> |
plot2:=plot({erf(xi),(1/a[optimal][0..5])*arctanh(xi)}, xi=0..5,0..5,color=black,th=2): |
> |
plots[display]({plot1,plot2}); |
The results show that the approximant
furnishes a suitable approximation to the error function
. In view of the inverse
and the approximant
the influence of the range [0, r] on the parameter a is less important.
> |
delta[infinity,1]:=approximant[infinity]-approximant[1]= tanh(1.202782517*xi)-tanh(1.172868316*xi); |
![`:=`(delta[infinity, 1], `+`(tanh(`*`(a, `*`(xi)))[infinity], `-`(tanh(`*`(a, `*`(xi)))[1])) = `+`(tanh(`+`(`*`(1.202782517, `*`(xi)))), `-`(tanh(`+`(`*`(1.172868316, `*`(xi)))))))](/view.aspx?SI=5525/Worksheet_293_43.gif) |
(4.5) |
> |
delta[infinity,2]:=approximant[infinity]-approximant[2]= tanh(1.202782517*xi)-tanh(1.201270935*xi); |
![`:=`(delta[infinity, 2], `+`(tanh(`*`(a, `*`(xi)))[infinity], `-`(tanh(`*`(a, `*`(xi)))[2])) = `+`(tanh(`+`(`*`(1.202782517, `*`(xi)))), `-`(tanh(`+`(`*`(1.201270935, `*`(xi)))))))](/view.aspx?SI=5525/Worksheet_293_44.gif) |
(4.6) |
> |
plot1:=plot({H(xi-5),tanh(1.202782517*xi),tanh(1.172868316*xi)}, xi=0..5.001,color=black): |
> |
plot2:=plot(1,xi=0..5,color=black, title="two approximants tanh(a*xi)"): |
> |
plots[display]({plot1,plot2}); |
> |
plot1:= plot({0.012*H(xi-2),tanh(1.202782517*xi)-tanh(1.172868316*xi), tanh(1.202782517*xi)-tanh(1.201270935*xi)}, xi=0..2.001,color=black): |
> |
plot2:=plot(0.012,xi=0..2,color=black, title="distance delta [..] between approximants"): |
> |
plots[display]({plot1,plot2}); |
The approximation dicussed above has been published in:
BETTEN, J.: Creep Mechanics, Springer-Verlag, Berlin/Heidelberg/New York, 2nd Edition 2005.
Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.