Application Center - Maplesoft

App Preview:

Inverse of the Error Function

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Image 

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: 

> restart:
 

> approximant:=tanh(a*xi);
 

`:=`(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);
 

`:=`(inverse, `/`(`*`(arctanh(xi)), `*`(a))) (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) (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)) (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) (2.5)
 

`:=`(a[optimal][0 .. 2], 1.201270935) (2.5)
 

`:=`(a[optimal][0 .. 3], 1.202760580) (2.5)
 

`:=`(a[optimal][0 .. 4], 1.202782281) (2.5)
 

`:=`(a[optimal][0 .. 5], 1.202782515) (2.5)
 

`:=`(a[optimal][0 .. infinity], 1.202782517) (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) (2.6)
 

`:=`(L_two[0 .. 2], 0.1428838030e-1) (2.6)
 

`:=`(L_two[0 .. 3], 0.1216051374e-1) (2.6)
 

`:=`(L_two[0 .. 4], 0.1053649880e-1) (2.6)
 

`:=`(L_two[0 .. 5], 0.9424169402e-2) (2.6)
 

`:=`(L_two[0 .. infinity], 0.) (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))))) (3.1)
 

`:=`(inverse[0 .. 2], `+`(`*`(.8324516734, `*`(arctanh(xi))))) (3.1)
 

`:=`(inverse[0 .. 3], `+`(`*`(.8314206640, `*`(arctanh(xi))))) (3.1)
 

`:=`(inverse[0 .. 4], `+`(`*`(.8314056632, `*`(arctanh(xi))))) (3.1)
 

`:=`(inverse[0 .. 5], `+`(`*`(.8314055014, `*`(arctanh(xi))))) (3.1)
 

`:=`(inverse[0 .. infinity], `+`(`*`(.8314055001, `*`(arctanh(xi))))) (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);
 

Plot_2d
 

> Delta(xi):=erf(xi)-tanh(a[optimal][0..2]*xi);
 

`:=`(Delta(xi), `+`(erf(xi), `-`(tanh(`+`(`*`(1.201270935, `*`(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.) (4.2)
 

`:=`(zero[1], .8439158081) (4.2)
 

`:=`(zero[2], fsolve(`+`(erf(xi), `-`(tanh(`+`(`*`(1.201270935, `*`(xi)))))) = 0, xi, 1 .. `/`(3, 2))) (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});
 

Plot_2d
 

> 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) (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) (4.4)
 

`:=`(L_two[1.19], 0.1457543612e-1) (4.4)
 

`:=`(L_two[1.201270935], 0.1428838030e-1) (4.4)
 

`:=`(L_two[1.21], 0.1445712660e-1) (4.4)
 

`:=`(L_two[1.22], 0.1504066478e-1) (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});
 

Plot_2d
 

> 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});
 

Plot_2d
 

> 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});
 

Plot_2d
 

 

  The results show that the approximant  Typesetting:-mrow(Typesetting:-mi( furnishes a suitable approximation to the error function Typesetting:-mrow(Typesetting:-mi(. In view of the inverse Typesetting:-mrow(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mn( and the approximant Typesetting:-mrow(Typesetting:-mi( 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))))))) (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))))))) (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});
 

Plot_2d
 

> 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});
 

Plot_2d
 

 

  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.

Image