 Application Center - Maplesoft

# Inverse of the Error Function

You can switch back to the summary page by clicking here. 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); (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; (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); (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; (2.5) (2.5) (2.5) (2.5) (2.5) (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; (2.6) (2.6) (2.6) (2.6) (2.6) (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; (3.1) (3.1) (3.1) (3.1) (3.1) (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; (4.2) (4.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}); > L_two[0..2]:=sqrt((1/2)*Int((Delta)^2,xi=0..2))= evalf(sqrt((1/2)*int((Delta(xi))^2,xi=0..2))); (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; (4.4) (4.4) (4.4) (4.4) (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= tanh(1.202782517*xi)-tanh(1.172868316*xi);

 > (4.5)

 > delta[infinity,2]:=approximant[infinity]-approximant= 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}); > 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. 