Analytical Approx. for Error Function 1 Arbitrarily Accurate Analytical Approximations for the Error Function
Roy M. Howard
School of Electrical Engineering Computing and Mathematical Sciences Curtin University, GPO Box U1987, Perth, 6845, Australia.
email: [email protected]
1 Dec 2020
Abstract In this paper a spline based integral approximation is utilized to propose a sequence of approximations to the error function that converge at a significantly faster manner than the default Taylor series. The approximations can be improved by utilizing the approximation erfx 1 for x » 1 . Two generalizations are possible, the first is based on demarcating the integration interval into m equally spaced sub-intervals. The second, it based on utilizing a larger fixed sub-interval, with a known integral, and a smaller sub-interval whose integral is to be approximated. Both generalizations lead to significantly improved accuracy. Further, the initial approximations, and the approximations arising from the first generalization, can be utilized as the inputs to a custom dynamical system to establish approximations with better convergence properties.
Indicative results include those of a fourth order approximation, based on four sub-intervals, which leads –7 to a relative error bound of 1.43 10 over the interval 0 . The corresponding sixteenth order –19 approximation achieves a relative error bound of 2.01 10 . Various approximations, that achieve the –4 –6 –10 –16 set relative error bounds of 10 , 10 , 10 and 10 , over 0 , are specified.
Applications include, first, the definition of functions that are upper and lower bounds, of arbitrary accuracy, for the error function. Second, new series for the error function. Third, new sequences of 2 approximations for exp–x which have significantly higher convergence properties that a Taylor series
approximation. Fourth, the definition of a complementary demarcation function eCx which satisfies the 2 2 constraint eCx +1erf x = . Fifth, arbitrarily accurate approximations for the power and harmonic distortion for a sinusoidal signal subject to a error function nonlinearity. Sixth, approximate expressions for the linear filtering of a step signal that is modelled by the error function.
Keywords Error function, function approximation, spline approximation, Gaussian function
MSC (2020): 33B20, 41A10, 41A15, 41A58
© Roy Howard 2020 Print Date: 3/12/20 2 Analytical Approx. for Error Function
1 Introduction
The error function arises in many areas of mathematics, science and scientific applications including diffu- sion associated with Brownian motion (Fick’s second law), the heat kernel for the heat equation, e.g. [13], the modelling of magnetization, e.g. [10], the modelling of transitions between two levels, for example, with the mod- elling of smooth or soft limiters, e.g. [14] and the psychometric function, e.g. [12], [24], the modelling of ampli- fier non-linearities, e.g. [28], [30], and the modelling of rubber like materials and soft tissue, e.g. [15], [23]. It is widely used in the modelling of random phenomena as the error function defines the cumulative distribution of the Gaussian probability density function and examples include, the probability of error in signal detection, option pricing via the Black-Scholes formula etc. Many other applications exist. In general, the error function is associ- ated with a macro description of physical phenomena and the De-Moivre Laplace theorem is illustrative of the link between fundamental outcomes and a higher level model. The error function is defined by the integral
x 2 –2 erfx = ------e d (1) 0 and the associated cumulative distribution function for the standard normal distribution is defined according to
x 2 1 – x x ==------exp ------d 0.5+ 0.5erf ------(2) 2 2 2 – The error function can also be defined in terms of the spherical Bessel functions (e.g. [31], eqn. 7.6.8) and the incomplete Gamma function (e.g. [31], eqn. 7.11.1). Marsaglia, [16], provides a brief insight into the history of the error function. Being defined by an integral, which does not have an explicit analytical form, there is interest in approxima- tions for the error function and over recent decades many approximations have been developed. Table 1 details indicative approximations. Most of the approximations detailed in this table are custom and have a limited rela- –5 –3 tive error bound with bounds in the range of 3.05 10 (Sandoval-Hernandez) to 7.07 10 (Menzel). It is preferable to have an approximation form that can be generalized to create approximations that converge to the error function. Examples include the standard Taylor series and the Bürmann series defined in Table 1. Many of the approximations detailed in Table 1 can be improved upon by approximating the associated resid- ual function, denoted g , via a Padé approximant or a basis set decomposition. Examples of some of the possible approximation forms, and the resulting residual functions, are detailed in Table 2. One example is that of a 42
Padé approximant for the function g3 which leads to the approximation:
2 3 4 2 4 a1x1 +++a2x1 a2x1 a2x1 x erfx 1 – exp –x --- 1 + ------x = ------ x 0 (3) 2 1 x + 1 1 + b1x1 + b2x1
279 –303 923 34783 40793 n = ------n = ------n = ------n = ------1 10 000 000 2 10 000 000 3 5 000 000 4 10 000 000 (4) –21 941 279 3 329 407 d = ------d = ------1 10 000 000 2 2 500 000
–7 The relative error bound in this approximation is 4.02 10 . Higher order Padé approximants can be used to generate approximations with a lower relative error bound. Matic, [17], provides a similar approximation with an –6 absolute error of 5.79 10 . An approximation for the error function can also be obtained by combining separate approximations, which are accurate, respectively, for x « 1 and x » 1 , via a demarcation function d
–x2 2x e erfx = ------ dx+ 1 –1------ – dx x 0 (5) x where
–x2 xerfx – xe+ dx= ------(6) 2 –x2 2x – x + e
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 3
Naturally, an approximation for d is required which requires an approximation for the error function. Unsurpris- ingly, the relative error in the approximation for the error function equals the relative error in the approximation utilized to approximate the error function in d . Finally, efficient numerical implementation of the error function is of interest and Chevillard, [6], and De Schrijver, [9], provide results and an overview. Highly accurate piecewise approximations have long been defined, e.g. [8].
Table 1. Examples of published approximations for erfx , 0 x . For the third and last approximations the coefficient definitions are detailed in the associated reference. The stated relative error bounds arise from sampling the interval 05 with 10,000 uniformly spaced points.
Relative # Reference Approximation error bound
1 Taylor series 3 5 n – 1 2 n 2 x x –1 x Tnx = ------ x – ------++------– ------ 31 52! nn – 1 2 ! n 135 2 Abramowitz, [1], p. 297, 3 2 5 3 7 n 2n + 1 2 2x 2 x 2 x 2 x –x2 eqn. 7.1.6 ------x ++------+------++ ------e 13 35 357 135 2n + 1 3 Abramowitz, [1], p. 299, –6 a a a a a –x2 8.09 10 Equations 7.1.26 1 – ------1 - ++++------2 ------3 ------4 ------5 e 2 3 4 5 1 + px 1 + px 1 + px 1 + px 1 + px
4 Menzel, [18], [19] 2 –3 –4x 7.07 10 Nadagopal, [20] 1 – exp ------ 5 Bürmann series 2 2 –3 2 2 31 –x 341 –2x ------1 – exp–x ------+ ------e – ------e 3.61 10 Schöpf, [27], eqn. 33. 2 200 8000 6 Winitzki, [34], eqn. 3. –4 2 2 4 + ax 8 – 3 3.50 10 1 – exp –x ------ a = ------2 1 + ax 34 – 7 Soranzo, [29], eqn 1. –4 2 a = 1.2735457 1.20 10 2 a1 + a2x 1 1 – exp –x ------ 2 4 a = 0.1487936 1 + b2x + b3x 2 –4 b2 = 0.1480931 b3 = 5.160 10 8 Vedder, [33], eqn 5. 3 –3 167x 11x 4.65 10 tanh ------+ ------148 109 9 Vazquez-Leal, [32], eqn. –4 39x 111 35x 1.88 10 3.1. tanh ------– ------ atan ------2 2 111 10 Sandoval-Hernandez, 2 –5 ------– 1 3.05 10 [25], eqn. 23. 3 5 7 9 1 + exp1x ++++3x 5x 7x 9x
Table 2. Residual functions associated with approximations for erfx , 0 x .
# Error function Residual Function 1 2x 2x tanh ------+ g1x g1x = erfx – tanh ------ 2 2x tanh ------1 + g2x g x = ------ atanherfx – 1 2 2x 3 – 2 2 4 g x = ------ ln1erf– x – 1 1 – exp –x ---1 + g x 3 2 3 4x
© Roy Howard 2020 Print Date: 3/12/20 4 Analytical Approx. for Error Function
rex 5 0.001 7 10-4
10-5 3
10-6 8 10
-7 10 4 9 6 10-8 0.001 0.010 0.100 1 x Fig. 1. Graph of the magnitude of the relative error in the approximations, detailed in Table 1, for erfx . The advance of this paper is to utilize the general spline based integral approximation, detailed in [11], to define a sequence of approximations that converge to the error function, and which can be made arbitrary accu- rate. The basic form of the approximation of order n , denoted fn , is
–x2 erfx fnx = pn 0x + pn 1x e (7) where pn 1 is a polynomial of order n and pn 0 is a polynomial of order less than n . Convergence of the sequence of approximations f1f2 to erfx is shown and the convergence is significantly better than the default Taylor series. For example, the second order approximation
2 2 4 x x x 11x x –x2 f2x = ------ 1 – ------+ ------ 1 ++------e (8) 30 30 15 yields as relative error bound of 0.056 over the interval 02 which is better that a fifteenth order Taylor series approximation. The approximations can be improved by utilizing the approximation erfx 1 for x » 1 and thereby establishing approximations with a set relative error bound over the interval 0 . Two generalizations are detailed. The first is of the form
2 2 –k1x –kmx erfx p0x +++p1x e pmx e (9) and is based on utilizing approximations associated with m equally spaced sub-intervals of the interval 0 x . The second, is based on utilizing a fixed sub-interval within 0 x and then approximating the error function over the remainder of the interval. Both generalizations lead to significantly improved accuracy. For example, a fourth order approximation based on four variable sub-intervals, when used with the approximation erfx 1 for –7 x » 1 , has a relative error bound of 1.43 10 over the interval 0 . The corresponding sixteenth order –19 approximation has a relative error bound of 2.01 10 . Finally, by utilizing the solutions of a custom dynami- cal system, approximations with better convergence properties can be established. Applications of the proposed approximations for the error function include, first, the definition of functions that are upper and lower bounds, of arbitrary accuracy, for the error function. Second, new series for the error 2 function. Third, new sequences of approximations for exp–x which have significantly higher convergence properties that a Taylor series approximation. Fourth, the definition of a complementary demarcation function 2 2 eCx which satisfies the constraint eCx +1erf x = , Fifth, arbitrarily accurate approximations for the power and harmonic distortion for a sinusoidal signal subject to a error function nonlinearity. Sixth, approximate expressions for the linear filtering of a step signal modelled by the error function. Section 2 details the spline based approximation for the error function and its convergence. Improved approx- imations, obtained by utilizing the nature of the error function for large arguments, are detailed in section 3. Two generalizations, with potential for lower relative error bounds, are detailed in sections 4 and 5. Section 6 details how the initial approximations, and the approximations arising from the first generalization, can be utilized as the inputs to a custom dynamical system to establish approximations with better convergence properties. Applications are specified in section 7. Conclusions are stated in section 8.
1.1 Notes and Notation
As erf–x = –erfx it is sufficient to consider approximations for the interval 0 .
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 5
For a function f defined over the interval , an approximating function fA has a relative error, at a point x1 , defined according to
fAx1 rex1 = 1 – ------(10) fx1 The relative error bound for the approximating function over the interval is defined according to
reB = max rex1 : x1 (11)
k k d The notation f x = fx is used. The symbol u denotes the unit step function. k dt Mathematica has been used to facilitate analysis and to obtain numerical results.
1.2 Background Results
The following result underpins the bounds proposed for the error function:
Lemma 1. Upper and Lower Functional Bounds
A positive approximation fA to a positive function f over the interval , with a relative error bound
fAx –1 – ------ x 0 (12) B fx B B leads to the following upper and lower bounded functions:
fAx fAx ------fx ------x (13) 1 + B 1 – B The relative error bounds, over the interval , for the upper and lower bounded functions, respectively, are:
2B 2B ------(14) 1 + B 1 – B
Proof The definition of the relative error bound, as specified by Equation 12, leads to
fAx 1 – ------1 + (15) B fx B which implies
1 – B fAx 1 + B fAx 1 – B 1 + B ------------1 1 ------(16) 1 + B fx fx 1 – B and the relative error bounds:
fAx 1 + B 1 – B 2B 1 + B –2B fAx 1 – B 01–1------– ------=1------– ------=1------–0------(17) fx 1 + B 1 + B 1 – B 1 – B fx
1.2.1 Convergent Integral Approximations One application of the proposed approximations for the error function requires knowledge of when function convergence implies convergence of associated integrals.
Lemma 2. Convergent Integral Approximation
If a sequence of functions f1f2 converges, over the interval 0 x , to a bounded and integrable function f , then pointwise convergence is sufficient for the associated integrals to be convergent, i.e. for
© Roy Howard 2020 Print Date: 3/12/20 6 Analytical Approx. for Error Function
x x
lim fn d = f d (18) n 0 0
Proof The required result follows if it is possible to interchange the order of limit and integration, i.e.
x x x
lim fn d ==lim fn d f d (19) n n 0 0 0 Standard conditions for when the interchange is valid are specified by the monotone and dominated convergence theorems, e.g. [4], p. 26. Sufficient conditions for a valid interchange include pointwise function convergence, and for f to be integrable and bounded.
2 Spline Based Approximations for Error Function
The following nth order, two point spline based, approximation for an integral has been detailed in [11], eqn. 48, for a function f which is at least n + 1 th order differentiable:
x n k + 1 k k k f d = cnk x – f + –1 f x + Rn x (20) k = 0 n 012 where
n! 2n + 1 – k ! c = ------ ------k 01 n (21) nk nk– !k + 1 ! 22n + 1 !
n 1 k k k + 1 n + 1 k R x = –+c k + 1 x – f + –1 ------f x n nk nk–1+ k = 0 (22) n + 1 n + 1 n + 1 cnn –1 x – f x Direct application of this result to the integral defining the error function leads to the following result:
Theorem 2.1 Spline Based Integral Approximation for Error Function The error function can be defined according to
erfx = fnx + nx (23) where fn is the nth order spline based integral approximation defined according to
n 2 k + 1 k –x2 fnx = ------ cnk x pk 0 + –1 pkx e (24) k = 0 and nx is the associated residual function whose derivative is
–x2 n 1 2e 2 k n x = ------– ------ cnk k + 1 x pk 0 – k = 0 (25) –x2 n 2e k k 2 1 ------ cnk x –1 k + 12– x pkx + xp kx k = 0 In these equations
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 7
1 pkx = p k – 1 x – 2xp k – 1 x p0 x = 1 (26) A more general approximation is
n 2 k + 1 –2 k –x2 ------erfx – erf = cnk x – pk e + –1 pkx e + n x (27) k = 0
= fn x + n x
Proof The proof is detailed in Appendix 1.
2.0.1 Note The polynomial function pkx is equivalently defined by the kth order Hermite polynomial function ([1], p. 775, equation 23.3.10) and an explicit form is
k 2 ik+ –1 k! k – 2i k – 2i pkx = ------ 2 x (28) i!k – 2i ! i = 0
2.0.2 Approximations The polynomial functions p , as defined by Equation 26 or Equation 28, have the explicit forms:
2 p0 x = 1 p1 x = –2x p2 x = –122– x (29) 2 2 4 p3 x = 12x12– x 3 p4 x = 12 1–4 4x + x 3 Approximations for the error function, as defined by Equation 24 and for order zero to five, are:
x x –x2 f0x = ------+ ------ e (30)
2 x x x –x2 f1x = ------+ ------1 + ----- e (31) 3
2 2 4 x x x 11x x –x2 f2x = ------1 – ------+ ------1 ++------e (32) 30 30 15
2 2 4 6 x x x 8x 17x x –x2 f3x = ------1 – ------+ ------1 ++------+------e (33) 21 21 210 105
2 4 2 4 6 8 x x x x 7x 37x 4x x –x2 f4x = ------1 – ------+ ------+ ------1 ++------++------e (34) 18 1260 18 420 315 945
2 4 2 4 6 8 10 x 2x x x 13x 61x 67x 16x x –x2 f5x = ------1 – ------+ ------+ ------1 ++++------+------e (35) 33 660 33 660 4620 10395 10395
2.1 Results
The relative error in the zero to tenth order spline based series approximations, along with the relative error in Taylor series approximations of order one to fifteen, are detailed in Figure 2. The clear superiority, is terms of convergence, of the spline based series, relative to the Taylor series, is evident. The relative error in the spline approximations, of orders 16, 20, 24, 28 and 32, are shown in Figure 3.
2.2 Approximation for Large Arguments
Zero and first order approximations for the error function, and for the case of x » 1 , are
© Roy Howard 2020 Print Date: 3/12/20 8 Analytical Approx. for Error Function
1315 order 0,1 rex 1 order 2 0.100 order 3 0.010 order 6 order 8 0.001 order 4 order 9 order 7 order 10 10-4 order 5
10-5
10-6 0 1 2 3 4 x Fig. 2. Graph of the magnitude of the relative errors in approximations to erfx : zero to tenth order integral spline based series and first, third, ..., fifteenth order Taylor series (dotted).
–x2 e erfx 1 erfx 1 – ------(36) x The relative errors in such approximations, respectively, are
–x2 1 1 – e x rex =re1 – ------x 1 – ------(37) erfx erfx and their graphs are shown in Figure 3. order 16 order 20 rex order 24 10-7 order 28 10-9
-11 10 order 32 10-13 erfx 1 2 –x -15 e 10 erfx 1 – ------x 10-17 3.0 3.5 4.0 4.5 5.0 5.5 6.0 x
Fig. 3. Graph of the magnitude of the relative errors associated with the approximation erfx 1 and 2 erfx 1 – exp–x x along with the relative error in spline approximations of orders 16, 20, 24, 28 and 32.
2.3 Convergence
To prove convergence of the sequence of functions f0f1 f2 , defined by Theorem 2.1, to the error func- tion, it is sufficient to prove that the corresponding sequence of residual functions 01 2 converge to zero. This can be shown by considering the derivatives of the residual functions defined by Equation 25. The deriva- tives of the residual functions of orders zero, one and two, respectively, are:
1 1 2 –x2 1 0 x = ------12+ x e – ------(38)
4 1 1 2 2x –x2 1 1 x = ------1 ++x ------e – ------(39) 3
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 9
2 4 6 2 1 1 9x 2x 2x –x2 1 x 2 x = ------1 +++------e – ------1 – ------(40) 10 5 15 10
Theorem 2.2 Convergence of Spline Based Approximations For all fixed values of x , the derivatives of the residual functions converge to zero as the order increases, i.e. for all fixed values of x it is the case that
1 limn x = 0 x 0 (41) n
This is sufficient for the convergence of the residual functions, i.e. limnx = 0 , x 0 , and, hence, for x n fixed:
limfnx = erfx x 0 (42) n The convergence is non-uniform.
Proof The proof is detailed in Appendix 2.
3 Improved Approximations
An improved approximation for the error function can be achieved by noting, as illustrated in Figure 3, that the approximation erfx 1 is increasingly accurate for the case of x » 1 and for x increasing. By switching at a suitable point xo , as illustrated in Figure 4, from a spline based approximation to the approximation erfx 1 , an improved approximation is achieved. Naturally, it is possible to switch to the approximation –x2 erfx 1 – e x , or higher order approximations, in a similar manner.
rex erfx 1 spline approx Fig. 4. Illustration of the crossover point where the magnitude of the relative error remax in the approximation erfx 1 equals the spline approx erfx 1 magnitude of the relative error in a set order spline approximation. x xo
Theorem 3.1 Improved Approximation for Error Function An improved approximation for the error function, based on a nth order spline approximation detailed in Theorem 2.1, and consistent with the illustration shown in Figure 4, is
erfx fnx uxon – x + 1 – uxon – x (43) where the transition point is defined according to
1 fnx x n = x: 1 –1------= – ------(44) o erfx erfx
Proof The improved approximation results follow from optimally switching, as illustrated in Figure 4 and at the point specified by Equation 44, to the approximation erfx 1 which has a lower relative error magnitude.
3.0.1 Transition Points and Relative Error Bounds The transition points, for various orders of spline approximation, are specified in Table 3. The relationship between the transition point and order is shown in Figure 5. This relationship can be approximated, with a second order polynomial, according to
© Roy Howard 2020 Print Date: 3/12/20 10 Analytical Approx. for Error Function
2 xon =01.3607+ 0.20511n – 0.002932n n 24 (45)
However, as small variations in xon can lead to significant changes in the maximum relative error in the approximation for the error function, precise values for xon are preferable. The graphs of the relative error variation in approximations to erfx for orders 246 20 , as specified by Equation 43, are shown in Figure 6. The relative error bounds that can be achieved, over the interval 0 , by using the optimally chosen transition points are detailed in Table 3.
Table 3. The transition points and the resulting relative error bounds for the spline based approximations specified by Equation 43. The transition points are based on sampling the interval 05 with 10000 points.
Approx. Transition Relative error order: n point: xon bound in fn 0 1.3085 0.0851 1 1.492 0.0362 2 1.658 0.0195 3 1.8975 –3 7.36 10 4 2.3715 –3 1.03 10 6 2.4715 –4 4.75 10 8 2.963 –5 2.79 10 10 3.0785 –5 1.35 10 12 3.4625 –7 9.78 10 14 3.5845 –7 4.00 10 16 3.9025 –8 3.44 10 18 4.0285 –8 1.22 10 20 4.300 –9 1.20 10 22 4.429 –10 3.76 10 24 4.6655 –11 4.18 10
xon
4
3
2
1
0 0 5 10 15 20 n Fig. 5. Graph of the relationship between the optimum transition point xon , as defined by Equation 44, and the order of the spline approximation.
3.1 Improved Approximation for Taylor Series
The approximation of erfx 1 for x » 1 can be utilized to improve the relative error bound for a Taylor series approximation according to
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 11
rex
0.001 order 4 order 6 order 2 order 8 10-5 order 10 order 12 order 14 -7 10 order 16 order 18 order 20 10-9
0 1 2 3 4 5 x
Fig. 6. Graph of the relative errors in approximations to erfx , of orders 246 20 , based on utilizing the approximation erfx 1 in an optimum manner.
erfx Tnx uxon – x + 1 – uxon – x (46) where Tn is a nth order Taylor series, n odd, as specified in Table 1. The optimum transition points and the rela- tive error bounds, for selected orders, are detailed in Table 4. The variation of the relative errors, with order, are shown in Figure 7. The change in the optimum transition point can be approximated according to
2 xon 0.932+ 0.0560n – 0.0003503n 3 n 61 (47) but, again, as small variations in xon can lead to significant changes in the maximum relative error in the approximation for the error function, precise values for xon are preferable. The clear superiority in the conver- gence of the spline based series is evident by a visual comparison of the relative errors shown in Figure 6 and Figure 7.
Table 4. The transition points, and the resulting relative error bounds, for Taylor series approximations specified by Equation 46. The transition points are based on sampling the interval 04 with 10000 points.
Transition point: Relative error Order: n xon bound in Tn
1 0.8864 0.266 3 1.078 0.146 5 1.222 0.0917 7 1.344 0.0609 9 1.4532 0.0416 13 1.6452 0.0204 17 1.8144 0.0105 21 –3 1.9672 5.44 10 25 –3 2.1084 2.89 10 29 –3 2.24 1.55 10 37 –4 2.4812 4.53 10 45 –4 2.70 1.35 10 53 –5 2.902 4.09 10 61 –5 3.09 1.24 10
© Roy Howard 2020 Print Date: 3/12/20 12 Analytical Approx. for Error Function
rex 0.100 1 0.010
0.001 3 5 10-4
10-5 7
10-6 9 13 17 21 25 29 37 45 53 61 0 1 2 3 4 x Fig. 7. Graph of the magnitude of the relative error in Taylor series approximations to erfx that utilize an optimized change to the approximation erfx 1 .
4 Variable Sub-interval Approximations for Error Function
An improved analytic approximation for the error function can be achieved by demarcating the interval 0 x into variable sub-intervals, e.g. the sub-intervals 0 x 4 , x 4 x 2 , x 2 3x 4 and 3x 4 x for the four sub-interval case, and by utilizing spline based integral approximations for each sub-interval. Chiani, [5], utilized sub-intervals to enhance approximations for the complementary error function.
Theorem 4.1 Variable Sub-Interval Approximations for Error Function The nth order spline based approximation to the error function, based on m equal width sub-intervals, is
m – 1 n 2 2 2 2 2 x k + 1 ix i x k i + 1 x i + 1 x f x = ------c ---- pk ---- exp–------+ – 1 pk ------exp –------(48) nm nk 2 2 m m m m m i = 0 k = 0 where
1 pkx = p k – 1 x – 2xp k – 1 x p0 x = 1 (49) An alternative form is
m – 1 2 2 2 i x 2 f x = ------p x ++p x exp –------p x exp–x (50) nm n 0 ni 2 nm m i = 1 where
n c k + 1 p x = ------nk - pk 0 x n 0 k + 1 m k = 0 n cnk k ix k + 1 p x = ------ 11+ – pk ---- x (51) ni k + 1 m m k = 0 n c k k + 1 p x = ------nk - –1 pkx x nm k + 1 m k = 0
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 13
Proof The first result follows by applying Equation 27 in Theorem 2.1 to the sub-intervals 0 xm , xm 2xm , , xxm– x . The alternative form arises by expanding the outer summation in Equation 48 and collecting terms of similar form.
4.1 Explicit Expressions
A first order approximation, based on m sub-intervals, is
m – 1 2 2 3 x –i x 2 x 2 f x = ------12++exp ------exp–x + ------ exp–x (52) 1 m 2 2 m m 3m i = 1 For the four sub-interval case, explicit expressions are
2 2 2 x –x –x –9x 2 f04 x = ------12+++exp------2exp------2exp ------+exp–x (53) 4 16 4 16
2 2 2 3 x –x –x –9x 2 x 2 f14 x = ------12+++exp------2exp------2exp ------+exp–x + ------ exp–x (54) 4 16 4 16 48 Using the alternative form, a fourth order expression is
2 4 x x x f44 x = ------1 – ------++------4 288 322560 2 2 4 6 8 x –x x 47x x x ------ exp------1 – ------+++------– ------2 16 288 107520 1 290 040 61 931 520 2 2 4 6 8 x –x x 187x x x ------ exp------1 – ------++------– ------+ (55) 2 4 288 107520 322560 3 870 720 2 2 4 6 8 x –9x x 1261x x 3x ------ exp------1 – ------++------– ------+ 2 16 288 322560 143360 2 293 760 2 4 6 8 x 2 31x 101x 19x x ------ exp–x 1 ++------+------+------4 288 15360 80640 241920 A fourth order spline approximation, which utilizes sixteen sub-intervals, is detailed in Appendix 3. This expres- sion, when utilized with the transition point xo = 7.1544 , yields an approximation with a relative error bound of –16 4.82 10 .
4.1.1 Results The relative errors in the spline approximations of orders one to six, and for the case of four equal sub-inter- vals 0 x 4 , x 4 x 2 , x 2 3x 4 and 3x 4 x , are shown in Figure 8.
4.2 Improved Approximation
The spline approximations utilizing variable sub-intervals can be improved by using the transition to the approximation erfx 1 at a suitable point as specified by Equation 43. The relative error in the spline approxi- mations of orders one to seven, and for the case of four equal sub-intervals 0 x 4 , x 4 x 2 , x 2 3x 4 and 3x 4 x , are updated in Figure 9 to show the improvement associated with utilizing the optimum transition point to the approximation erfx 1 . The relative error bounds, and transition points, are detailed in Table 5 and Table 6 for the case of four and sixteen sub-interval cases.
© Roy Howard 2020 Print Date: 3/12/20 14 Analytical Approx. for Error Function
rex f14 x 0.001 f24 x f x 10-4 34 f x 10-5 44 f x 10-6 54
-7 10 f64 x
10-8 0 1 2 3 4 5 x Fig. 8. Graph of the relative errors in spline approximations to erfx , of orders one to six and based on four variable sub-intervals of equal width.
Table 5. Transition point and relative error bound for the four equal sub-interval case. The transition points are based on sampling the interval 08 with 10000 points.
spline order transition point relative error bound
0 –3 2.7016 5.32 10 1 –5 3.292 7.21 10 2 –6 3.4544 1.27 10 4 –7 3.7208 1.43 10 8 –11 4.6616 4.34 10 12 –16 5.6784 9.75 10 16 –19 6.3736 2.01 10 20 –24 7.1544 4.62 10 24 –27 7.7136 1.06 10
Table 6. Transition point and relative error bound for the sixteen equal sub-interval case. The transition points are based on sampling the interval 012 with 10000 points.
spline order transition point relative error bound
0 –4 5.5008 3.32 10 1 –7 6.8796 2.82 10 2 –10 7.0224 3.137 10 4 –16 7.1544 4.82 10 8 –27 7.5996 6.22 10 12 –31 8.2032 4.16 10 16 –36 8.9244 1.66 10 20 –43 9.7284 4.68 10 24 –50 10.584 1.21 10
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 15
rex 10-4
10-5 order 1 order 2 10-6 order 4 10-7 order 3 order 5 10-8 order 6 10-9 order 7 0 1 2 3 4 5 x Fig. 9. Graph of the relative errors in approximations to erfx : first to seventh order spline based series based on four sub- intervals of equal width and with utilization of the approximation erfx 1 at the optimum transition point.
4.2.1 Examples A first order approximation, based on m sub-intervals, as specified by Equation 52, yields the relative error –5 –6 bound of 7.21 10 for four sub-intervals and with the transition point xo = 3.2928 , 4.51 10 for eight –7 sub-intervals and with the transition point xo = 4.784 , 2.82 10 for sixteen sub-intervals and with the transi- –9 tion point of xo = 6.88 , and 1.10 10 for sixty four sub-intervals and the transition point xo = 15.7888 . The fourth order approximation, based on four equal sub-intervals, as specified by Equation 55, leads to the rela- –7 tive error bound of 1.43 10 when used with the transition point xo = 3.7208 . A sixteenth order approxima- –19 tion, based on four equal sub-intervals, leads to an error bound of 2.01 10 when used with the optimum transition point of xo = 6.3736 .
5 Dynamic Constant plus Spline Approximation
Consider the demarcation of the areas, as illustrated in Figure 10 and based on a resolution , that define the error function. It follows that
x x 2 c = 0 2 – 0 ------erfx = ck + e d (56) ck = erfk – erfk – 1 k 1 k = 0 x For the general case of non-uniformly spaced intervals, as defined by the set of monotonically increasing points x0x1 x2 xm , and where it is not necessarily the case that xx m , the error function is defined according to
m x 2 –2 erfx = ckux– xk + ------e d (57) k = 1 xS where c0 = 0 , x0 = 0 and
m
ck = erfxk – erfxk – 1 xS = xk – xk – 1 ux– xk (58) k = 1 A spline based approximation, as defined by Equation 27, can be utilized for the unknown integrals in Equation 56 and Equation 57. This leads to the following results:
© Roy Howard 2020 Print Date: 3/12/20 16 Analytical Approx. for Error Function
2 ------ 2 –x2 ------e area known area c1 area c2 area to be approximated x ko = --- x x 2 ko – 1 ko Fig. 10. Illustration of areas comprising erfx .
Theorem 5.1 Error Function Approximation a Dynamic Constant Plus a Spline Approximation The error function, as defined by Equation 56 and Equation 57 can be approximated, respectively, by the approximations
x n 2 x k + 1 x 2 x 2 k 2 fn x = ck + ------cnk x – --- pk --- exp– --- + – 1 pkx exp–x (59) k = 0 k = 0
m n 2 k + 1 2 k 2 erfx ckux– xk + ------cnk xx– S pkx S exp–xS + – 1 pkx exp–x (60) k = 1 k = 0
Proof These results arise from spline approximation of order n , as defined by Equation 27, for the integrals, respec- tively, over the intervals x x and xS x .
5.1 Approximations of Orders Zeros to Four
Approximations of orders zero to four arising, from Theorem 5.1, are:
x x – x –2 x 2 –x2 f0 x = ck + ------ e + e (61) k = 0
x 2 x – x –2 x 2 –x2 x – x –2 x 2 –x2 f1 x = ck + ------ e + e – ------ x e – xe (62) 3 k = 0
x 2 x – x –2 x 2 –x2 2x – x –2 x 2 –x2 f2 x = ck + ------ e + e – ------ x e ––xe 5 k = 0 (63) 3 x – x 2 2 –2 x 2 2 –x2 ------ 12– x e + 12– x e 30
x 2 x – x –2 x 2 –x2 3x – x –2 x 2 –x2 f3 x = ck + ------ e + e – ------ x e ––xe 7 k = 0 3 x – x 2 2 –2 x 2 2 –x2 ------ 12– x e + 12– x e + (64) 21 4 2 2 2 x – x 2 x –2 x 2 2x –x2 ------ x 1 – ------e – x 1 – ------e 70 3 3
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 17
x 2 x – x –2 x 2 –x2 4x – x –2 x 2 –x2 f4 x = ck + ------ e + e – ------ x e ––xe 9 k = 0 3 x – x 2 2 –2 x 2 2 –x2 ------ 12– x e + 12– x e + 18 (65) 4 2 2 2 x – x 2 x –2 x 2 2x –x2 ------ x 1 – ------e – x 1 – ------e + 42 3 3 5 4 4 4 x – x 2 2 4 x –2 x 2 2 4x –x2 ------ 14– x + ------e + 14– x + ------e 1260 3 3
5.2 Results
For a resolution of = 12 , the coefficients are tabulated in Figure 10.
Table 7. Coefficient values for the case of = 12 .
k Definition for ck ck
1 –1 erf 1 2 5.204998778 10 2 –1 erf 1 – erf 1 2 3.222009151 10 3 –1 erf 3 2 – erf 1 1.234043535 10 4 –2 erf 2 – erf 3 2 2.921711854 10 5 –3 erf 5 2 – erf 2 4.270782964 10 6 –4 erf 3 – erf 5 2 3.848615204 10 7 –5 erf 7 2 – erf 3 2.134739863 10 8 –7 erf 4 – erf 7 2 7.276811144 10 9 –8 erf 9 2 – erf 4 1.522064186 10 10 –10 erf 5 – erf 9 2 1.950785844 10 11 –12 erf 11 2 – erf 5 1.530101947 10 12 –15 erf 6 – erf 11 2 7.336328181 10
–5 A resolution of = 12 yields a relative error bound of 1.16 10 for a second order approximation, a –9 –14 relative error bound of 1.35 10 for a fourth order approximation, a relative error bound of 7.15 10 for a –37 sixth order approximation and a relative error bound of 9.03 10 for a sixteenth order approximation. These bounds are based on 10000 equal spaced samples in the interval 08 . The variation of the relative error bound with resolution, and order, is detailed in Figure 11. The nature of the variation of the relative error, for orders two, three and four, is shown in Figure 12 for the case of resolution of 0.5 . It is possible to obtain better results by using non-uniformly spaced intervals but the improvement, in gen- eral, does not warrant the increase in complexity.
6 A Dynamical System to Yield Improved Approximations
It is possible to utilize the approximations detailed in Theorem 2.1 and Theorem 4.1 as the basis for determin- ing new approximations with a lower relative error. The approach is indirect and based on considering the feed- back system illustrated in Figure 13 which has dynamically varying feedback. The differential equation characterizing the system is
yt + fMt yt= xt (66)
© Roy Howard 2020 Print Date: 3/12/20 18 Analytical Approx. for Error Function
re bound 1
10-5 = 1 = 34
10-10 = 12
= 14 = 32 10-15 = 18
10-20 = 116 0 5 10 15 order Fig. 11. Graph of the relative error bound, versus the order of approximation, for various set resolutions.
rex order 2 10-6
order 3 10-8 order 4
10-10
10-12
0 1 2 3 4 5 6 x Fig. 12. Graph of the relative errors, based on a resolution of = 0.5 , in second to fourth order approximations to erfx .
xt yt -
fMt Fig. 13. Feedback system with dynamically varying (modulated) feedback.
For specific input, x , and modulated feedback, fM , signals the output has a known form. For example, for the case of xt==fMt erft ut , the output signal, assuming zero initial conditions, is
1 –t2 yt= 1 – exp ------ 1 – e – terft t 0 (67) For the case of
4 –t2 xt==fMt ------e erft ut (68) the output signal, assuming zero initial conditions, is
2 yt= 1erf– exp– t t 0 (69) This case facilitates approximations for the error function which can be made arbitrarily accurate and which are valid for the positive real line.
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 19
Theorem 6.1 Dynamical System Approximations for Error Function The nth order approximations, to erfx , for the case of x 0 , is:
–x2 –2x2 fnx = pn 0 ++pn 1x e pn 2x e (70) where, for the case of n 2 :
2 m n – 1 n odd pn 1x = 0 +++2x mx m = nm even (71) 2 2n pn 2x = 0 +++2x 2nx
pn 0 = –0 + 0 and with
–4 = ------ c a m nm m 0
m –22i + m –22i + 4 m m – 2i = ------– --- cnm – 2iam –02i i 1 ---- – 1 (72) 2 2 4 = – --- c a 0 2 n 0 00
–2 n = ------ –1 c a 2n nn nn min 2n – 2i n ni–1+ 2 k = ------2n –22i + - – --- –1 c a i 1 n – 1 2n – 2i 2 nk k 2ni– – k (73) kni= – 2 = -----2 – --- c a 0 2 n 0 00
Here, the coefficients aij , ij 01 n are defined by the expansion
2 k pkx = ak 0 ++ak 1xak 2x ++ akk x k 01 n (74) arising from the polynomials (Equation 26)
1 pkx = p k – 1 x – 2xp k – 1 x p0 x = 1 (75) Finally, it is the case that
limfnx = erfx x 0 (76) n with the convergence being uniform.
Proof The proof is detailed in Appendix 4.
6.1 Explicit Approximations
Explicit approximations for orders zero to four for erfx , x 0 are:
1 –x2 –2x2 f0x = ------32– e – e (77)
–2x2 2 1 19 –x2 7e 2x f1x = ------– 2e – ------1 + ------(78) 6 6 7
© Roy Howard 2020 Print Date: 3/12/20 20 Analytical Approx. for Error Function
–x2 2 –2x2 2 4 1 63 29e x 73e 26x 4x f2x = ------– ------1 – ------– ------1 ++------(79) 20 15 29 60 73 73
–x2 2 –2x2 2 4 6 1 22 40e x 26e 10x x x f3x = ------– ------1 – ------– ------1 +++------(80) 7 21 20 21 26 13 130
–x2 2 4 –2x2 2 4 6 6 1 377 596e 17x x 3149e 1258x 278x 112x 8x f4x = ------– ------1 – ------+ ------– ------1 ++++------(81) 120 315 298 1192 2520 3149 3149 9447 9447
6.2 Results
The relative error bounds associated with the approximations to erfx , are detailed in Table 8. The graphs of the relative errors in the approximations are shown in Figure 14. The clear advantage of the proposed approxima- tions is evident with the improvement increasing with the order of the initial approximation (i.e. a function with an initial lower relative error bound leads to an increasingly lower relative error bound). The other clear advan- tage of the approximations, as is evident in Figure 14, is that the relative error is bounded as x .
Table 8. Relative error bounds, over the interval 0 , for approximations to erfx as defined in Theorem 6.1.
Relative error bound: original Relative error series - optimum bound: Approx. Order of transition point defined by approx. (Table 3). Equation 70.
0 0.0851 –2 2.68 10 1 0.0362 –3 3.98 10 2 0.0195 –3 1.34 10 3 –3 –4 7.36 10 2.03 10 4 –3 –5 1.03 10 1.82 10 6 –4 –7 4.75 10 9.20 10 8 –5 –8 2.79 10 1.69 10 10 –5 –10 1.35 10 7.43 10 12 –7 –11 9.78 10 1.67 10 14 –7 –13 4.00 10 6.47 10 16 –8 –14 3.44 10 1.68 10 18 –8 –16 1.22 10 5.90 10 20 –9 –17 1.20 10 1.73 10 22 –10 –19 3.76 10 5.56 10 24 –11 –20 4.18 10 1.79 10
6.3 Extension
By utilizing the approximations detailed in Theorem 4.1 similar approximations can be detailed, with lower relative error. For example, the first order approximation, f14 , which is based on four equal sub-intervals and is defined by Equation 54, yields the approximation
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 21
rex order 1 0.001 order 2 order 3 10-4
10-5 order 4 order 5 10-6 order 6
10-7 order 7 order 8 10-8 0.1 0.5 1 5 10 x Fig. 14. Graph of the relative errors in approximations, of orders one to eight, to erfx as defined in Theorem 6.1.
–x2 –17x2 16 –5x2 4 –25x2 16 –2x2 2 1 128177 e 16e 4e 16e 25e 2x f14 x = ------– ------– ------– ------– ------–1------+ ------(82) 40800 2 17 5 25 96 25
–6 which has a relative error bound of 2.83 10 . With an optimum transition point of 3.292 the original approxi- –5 mation has a relative error bound of 7.21 10 (see Table 5).
6.4 Notes
First, the constants pn 0 , n 01 , as defined in Equation 71, form a series that in the limit converges to 1 . It then follows that the corresponding series converges to :
19 63 22 377 174169 4 528 409 3------------------ (83) 6 20 7 120 55440 1 441 440 Second, the square root functional structure has been utilized for approximations for the error function as is evident from the approximations detailed in Table 1. It is easy to conclude that the form
2 2 –k1x –k2x fnx = pn 0 – pn 1x e – pn 2x e – (84) is well suited for approximating the error function.
7 Applications
This section details indicative applications of the approximations for the error function that have been detailed above.
7.1 Approximation for Exp(-x2)
2 A nth order approximation to the Gaussian function exp–x is detailed in the following theorem:
Theorem 7.1 Approximation for Gaussian Function 2 A nth order approximation, gn to the Gaussian function exp–x is
n k cnk k + 1 x pk 0 k = 0 g x = ------(85) n n k + 1 k 2 1 1 + cnk –1 x pkx k + 12– x + xp kx k = 0
© Roy Howard 2020 Print Date: 3/12/20 22 Analytical Approx. for Error Function
where cnk is defined by Equation 21 and pkx is defined by Equation 26.
Proof The proof is detailed in Appendix 5.
7.1.1 Approximations
2 Approximations to exp–x , of orders zero to five, are:
2 1 1 1 – x 10 g x = ------g x = ------g x = ------(86) 0 2 1 4 2 2 4 6 12+ x 2 2x 9x 2x 2x 1 ++x ------1 +++------3 10 5 15
2 2 4 1 – x 7 1 – x 6 + x 252 g x = ------g x = ------(87) 3 2 4 6 8 4 2 4 6 8 10 6x 5x 2x 2x 5x 85x 11x x 2x 1 ++++------1 ++------+------++------7 14 21 105 6 252 126 63 945
2 4 2x x 1 – ------+ ------11 132 g x = ------(88) 5 2 4 6 8 10 12 9x 43x x x x 2x 1 ++------++++------11 132 12 66 495 10395
7.1.2 Results
2 The relative errors in the above defined approximations to exp–x are detailed in Figure 15 for approxima- tions of order 0, 2, 4, 6, 8, 10 and 12 along with the relative error in Taylor series for orders 135 15 . The clear superiority of the defined approximations is evident. order 4 rex 1 15 order 6 0.100 order 0 order 8 0.010 13 5 0.001 order 10 order 2 10-4 order 12 10-5
10-6 0.0 0.5 1.0 1.5 2.0 2.5 3.0 x Fig. 15. Graph of the magnitude of the relative errors in 2 approximations to exp–x , as defined by Equation 85, of orders 0, 2, 4, 6, 8, 10 and 12. The dotted curves are the relative errors associated with Taylor series of orders 1, 3, 5, 7, 9, 11, 13 and 15.
7.1.3 Comparison
2 The following nth order approximation for exp–x has been proposed in [11], eqn. 77:
2 4 6 n + 1 2n + 2 1 – cn 0x + cn 1x – cn 2x ++ cnn –1 x h x = ------(89) n 2 4 6 2n + 2 1 +++cn 0x cn 1x cn 2x ++ cnn x where cnk is defined by Equation 21. The relative error bounds over the interval 03 2 (the three sigma bound case for Gaussian probability distributions) for this approximation, and the approximation defined by Equation 85, are detailed in Table 9. The tabulated results clearly show that this approximation is more accurate the approximation detailed in Equation 85. The improvement is consistent with the higher order Padé approxi- mant being used.
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 23
The following approximations (seventh and fifth order) yield relative error bounds of less than 0.001 over the interval 03 2 :
2 4 6 x x x 1– ----- + ------– ------5 78 4290 g x = ------(90) 7 2 4 6 8 10 12 14 16 4x 61x 34x 83x x 7x 4x 2x 1 ++------+------+------+------++------+------5 195 429 5720 495 32175 225225 2027025
2 4 6 8 10 12 x 5x x x x x 1– ----- ++------– ------– ------+ ------2 44 66 792 15840 665280 h x = ------(91) 5 2 4 6 8 10 12 x 5x x x x x 1 ++------++------+------+ ------2 44 66 792 15840 665280
–3 A twenty seventh order Taylor series approximation yields a relative bound of 1.03 10 .
Table 9. Relative error bounds for approximations over the interval 03 2 .
Relative error Relative error Order of bound: bound: Howard approx. Equation 85. 2019, eqn 77. 0 8.00 35.6 13.746.98 2 0.957 0.767 3 –1 –2 1.25 10 5.25 10 4 –3 –3 8.04 10 2.42 10 5 –3 –5 7.71 10 7.98 10 6 –3 –6 2.09 10 1.97 10 7 –4 –8 3.72 10 3.75 10 8 –5 –10 5.02 10 5.69 10 10 –7 –14 4.54 10 7.22 10 12 –9 –18 1.09 10 4.62 10
7.2 Error Function Approximations: Set Relative Error Bounds
Consider the case where an approximation for the error function, with a relative error bound over the positive –4 real line of 10 , is required. A 47th order Taylor series, with a transition point of xo = 2.752 , yields a relative 4 bound of 1.00 10 . An eighth order spline approximation, with a transition point of xo = 2.963 , yields a relative error bound of –5 2.79 10 . The approximation, according to Equation 43, is
2 4 6 8 x 7x x x x f8x = ------uxo – x 1 – ------+++------– ------ 102 340 18564 5 250 960
2 4 6 8 10 12 41x 101x 1591x 4793x 2017x 38x 1 ++------+------+------+------+------+ (92) 102 1020 92820 2 162 160 9 189 180 2 297 295 –x2 e + 14 16 31x x ------+ ------34 459 425 34 459 425
1 – uxo – x
© Roy Howard 2020 Print Date: 3/12/20 24 Analytical Approx. for Error Function
A seventh order approximation, with a transition point of xo = 2.65 , yields a relative error bound of –4 1.79 10 . A first order spline approximation, based on four equal sub-intervals 0 x 4 , x 4 x 2 , x 2 3x 4 and 3x 4 x , is defined according to
2 2 2 3 x –x –x –9x 2 x 2 f14 x = ------ 12+++exp------2exp------2exp ------+exp–x + ------ exp–x uxo – x + 4 16 4 16 48 (93)
1 – uxo – x
–5 and yields a relative error bound of 7.21 10 with the transition point xo = 3.292 . A dynamic constant plus a spline approximation of order 2 , and based on a resolution of = 19 20 –5 achieves a relative error bound of 8.33 10 (10000 points in the interval 05 ). The approximation is
20x 19 2 1 19 20x –361 20x 2 –x f2 x = ck + ------x – ------ ------exp ------+–e 20 19 400 19 k = 0 2 2 19 2 19 20x –361 20x 2 –x (94) ------x – ------ ------20x------ ------exp ------––xe 5 20 19 20 19 400 19 2 1 19 20x 3 361 20x 2 –361 20x 2 2 –x ------x – ------ ------ 1 – ------exp------+ 1– 2x e 30 20 19 200 19 400 19 where
19k 19k – 1 c = 0 c = erf ------– erf ------k 12 0 k 20 20 (95) c1 = 0.82089081 c2 = 0.17189962 –3 –5 c3 = 7.1539145 10 c4 = 5.5579 10 c5 ===c6 0 Here, the approximation of erfx 1 , for x 57 20 (after three intervals) can be utilized without impacting the relative error bound. Utilizing a fourth order spline approximation and iteration consistent with Theorem 6.1, the approximation
–x2 2 4 –2x2 2 4 6 6 1 377 596e 17x x 3149e 1258x 278x 112x 8x f4x = ------– ------1 – ------+ ------– ------1 ++++------(96) 120 315 298 1192 2520 3149 3149 9447 9447
–5 yields a relative error bound of 1.82 10 . Details of approximations that are consistent with higher order relative error bounds are detailed in Table 10.
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 25
Table 10. Approximations that are consistent with a set relative error bound. The actual relative error bound is specified by reB .
Relative Variable interval Dynamic constant error Spline approx: approx: plus spline approx: Iterative approx: bound Theorem 3.1 Theorem 4.1 Theorem 5.1 Theorem 6.1
–6 10 order= 12 order= 5 order= 3 order= 6 3 sub-intervals –7 xo = 3.4625 resolution= 3 4 reB = 9.20 10 x = 3.51 –7 –7 o re = 5.53 10 reB = 9.78 10 B –7 reB = 6.96 10 –10 10 order= 23 order= 8 order= 4 order= 11 4 sub-intervals –10 xo = 4.581 resolution= 3 8 reB = 1.34 10 x = 4.6616 –11 –11 o re = 9.12 10 reB = 9.31 10 B order= 12 –11 reB = 4.34 10 –11 reB = 1.67 10 –16 10 order= 39 order= 11 order= 6 order= 19 6 sub-intervals –16 xo = 5.9017 resolution= 1 4 reB = 1.18 10 x = 5.98 –17 –17 o re = 1.01 10 reB = 7.21 10 B order= 20 –17 reB = 2.75 10 –17 reB = 1.73 10
7.3 Upper and Lower Bounded Approximations to Error Function
Establishing bounds for erfx has received modest research interest, e.g. [3] and published bounds for erfx for the case of x 0 include: Chu [7]:
2 2 1 –erfexp–px x 1 – exp–qx p 01 q 4 (97) Neuman, [21], Corollary 4.2:
2 2 2x –x 4x exp–x ------exp------ erfx ------1 + ------(98) 3 3 2 and refinements to the form proposed by Chu [7], e.g. Yang [35], [36], Corollary 3.4:
2 20 –8x 8 5 2 1 – ------1 – --- exp ------–erf--- 1 – ------exp–x x 3 4 5 3 2 (99) 2 2 1 –1p0 exp–p0x – – p0 exp– p0 x where
2 21 –60 + 3 147 –920 + 1440 p = ------0 30 – 3 (100) 47 –520 – – 3 p 45p – 7 p = ------p = ------2 15p –2840p + 53p – 4 The relative error in these bounds are detailed in Figure 16. Utilizing the results of Lemma 1, it follows that any of the approximations detailed in Theorem 3.1, Theorem 4.1, Theorem 5.1 or Theorem 6.1 can be utilized to create upper and lower bounded functions for
© Roy Howard 2020 Print Date: 3/12/20 26 Analytical Approx. for Error Function
boundx upper 2 1 – ------1 erfx lower 1 lower 2 0.100
0.010 upper 1 0.001 lower 3 upper 3 10-4 10-5 10-6 0 1 2 3 4 x Fig. 16. Relative error in upper and lower bounds to erfx as, respectively, defined by Equation 97, Equation 98 and Equation 99. The parameters p = 1 and q = 4 have been used for the bounds defined by Equation 97. erfx , x 0 , of arbitrary accuracy and with an arbitrary relative error bound. For example, the approximation f14 specified by Equation 93, yields the functional bounds:
f14 x f14 x –5 ------erfx ------B = 7.21 10 x 0 (101) 1 + B 1 – B
–5 –4 with a relative error bound of 8.33 10 for the lower bounded function and 1.44 10 for the upper bounded function. Such accuracy is better than the bounds underpinning the results shown in Figure 16. The sixteenth order approximation, f416 , based on four equal sub-intervals, specified in Appendix 3 and when used with a transition point xo = 7.1544 , leads to the functional bounds
f416 x f416 x –16 ------erfx ------B = 4.82 10 x 0 (102) 1 + B 1 – B
–16 –16 with a relative error bound of less than 9.64 10 for the lower bounded function and 9.32 10 for the upper bounded function.
7.4 New Series for Error Function
Consider the exact results
erfx = fnx + nx n 012 (103)
1 where fn is specified by Equation 24 and n x is specified by Equation 25. By utilizing a Taylor series approx- 2 1 imation for exp–x in n x and then by integrating, an approximation for nx can be established. This leads to new series for the error function.
Theorem 7.2 New Series for Error Function Based on zero, first and second order approximations the following series for the error function are valid:
x x –x2 erfx = ------+ ------ e + (104) 3 2 4 6 8 k 2k x 1 3x 5x 7x 9x –1 2k + 1 x ------– ------++------– ------– +------+ 3 25 67 24 9 120 11 2k + 3 k + 1 !
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 27
2 x x x –x2 erfx = ------++------1 + ----- e 3
5 2 4 6 8 k 2k (105) x 1 3x 5x 7x 9x –1 2k + 1 k + 1 !x ------ --- – ------+++------– ------– ------+ 6 5 32 7 49 15 11 72 13 k r 2k + 5 2i + 1 r = 1 i = 1
2 2 4 x x x 11x x –x2 erfx = ------1 – ------++------1 ++------e 30 30 15
7 2 4 6 k 2k (106) 1 x 13 35 x 57 x 79 x –1 2k + 1 2k + 3 k + 1 !x ------------– ------++++------– ------ ------ 60 137 239 4511 91013 k + 1 r 32k + 7 2 i r = 2 i = 2
Further series, based on higher order approximations, can also be established.
Proof The proof is detailed in Appendix 6.
7.4.1 Results The relative errors associated with the zero and second order series are shown in Figure 17 and Figure 18. Clearly, the relative error improves as the number of terms used in the series expansion increases. The significant improvement in the relative error, for x small, is evident. A comparison with the relative errors associated with Taylor series approximations, as shown in Figure 2, shows the improved performance. The second order approximation arising from Equation 105, i.e.
2 5 2 x x x –x2 x 1 2x erfx = ------++------1 + ----- e ------ --- – ------(107) 3 6 5 7 yields a relative error bound of less than 0.001 for the interval 0.87 and less than 0.01 for the interval 01.1 .
24618 20 f x rex 1 0
0.100
0.010
0.001
10-4
10-5
10-6 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 x
Fig. 17. Relative error in the approximations f0x and f0x + 0x to erfx where the residual function 0x is approximated by the stated order.
7.5 Complementary Demarcation Functions
Consider a complementary function eC which is such that
© Roy Howard 2020 Print Date: 3/12/20 28 Analytical Approx. for Error Function
rex 1 4 6 18
0.100 2 20 f2x 0.010
0.001
10-4
10-5
10-6 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 x
Fig. 18. Relative error in the approximations f2x and f2x + 2x to erfx where the residual function 2x is approximated by the stated order.
2 2 eCx +1erf x = x 0 (108)
With the approximation detailed in Theorem 6.1 (and by noting that limpn 0 = 1 - see Equation 83) it is the n case that
2 –x2 –2x2 eCx = lim pn 1x e + pn 2x e (109) n and, thus, eCx can be defined independently of the error function. This function is shown in Figure 19 along 2 with erfx . These two functions act as complementary demarcation functions for the interval 0 . The tran- sition point is xo = 0.74373198514677 as
1 erfx = ------(110) x = 0.74373198514677 2
2 1.0 erfx
0.8
0.6
0.4
0.2 2 0.0 eCx 0.0 0.5 1.0 1.5 2.0 x xo 2 2 Fig. 19. Graph of the signals eCx and erfx .
7.6 Power and Harmonic Distortion: Erf Modelled Non-linearity
The error function is often used to model nonlinearities and the harmonic distortion created by such a nonlin- earity is of interest. Examples include the harmonic distortion in magnetic recording, e.g. [2], [10], and the har- monic distortion arising, in a communication context, by a power amplifier, e.g. [30]. For these cases the interest was in obtaining, with a sinusoidal input signal defined by asin2fot , the harmonic distortion created by an error function nonlinearity over the input amplitude range of –22 . Consider the output signal of a nonlinearity modelled by the error function:
yt= erfasin2fot (111)
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 29
For such a case, the output power is defined according to
T T 1 2 1 2 P ==--- y t dt --- erf asin2f t dt T = 1 f (112) T T o o 0 0 and the output amplitude associated with the kth harmonic is
T 2 ------erfasin2fot sin2kfot dt (113) T 0 To determine an analytical approximation to the output power, the approximations stated in Theorem 6.1 lead to relatively simple expressions. Consider the third order approximation, as specified by Equation 80, which has a –4 relative error bound of 2.03 10 for the positive real line. For such a case, the output signal is approximated according to
2 12 –a sin2f t 2 22 40e o asin2f t ------––------1 – ------o 1 7 21 20 y3t = ------(114) –2a sin2f t 2 2 4 6 26e o 10asin2f t asin2f t asin2f t ------1 +++------o ------o ------o 21 26 13 130 and is shown in Figure 20.
y3t 1.0 a = 2 a = 1 0.5 a = 0.5 0.0
-0.5
-1.0 0.0 0.2 0.4 0.6 0.8 1.0 t
Fig. 20. Graph of y3t for the case of fo = 1 and for amplitudes of a = 0.5 , a = 1 , a = 1.5 and a = 2 .
The power in y3 can be readily be determined (e.g. via use of Mathematica) and it then follows that an approxi- mation to the true power is
2 2 2 4 6 22 40 a a –a2 2 26 2 5a 41a a –a2 Pa ------– ------I ----- 1 – ------e ––------I a 1 ++------+------e 7 21 0 2 40 21 0 26 1040 260 (115) 2 2 2 2 4 a a –a2 2 37a 2 43a 2a –a2 ------I ----- e + ------I a 1 ++------e 21 1 2 140 1 222 111 where I0 and I1 , respectively, are the zero and first order Bessel functions of the first kind. The variation in out- put power is shown in Figure 21.
© Roy Howard 2020 Print Date: 3/12/20 30 Analytical Approx. for Error Function
2 2.0 a 2
1.5
1.0 Pa 0.5 Pa ------2 a 2 0.0 0.0 0.5 1.0 1.5 2.0 a Fig. 21. Graph of the input power, output power and ratio of output power to input power as the amplitude of the input signal varies.
7.6.1 Harmonic Distortion To establish analytical approximations for the harmonic distortion, the functional forms detailed in Theorem 6.1 are not suitable. However, the functional forms detailed in Theorem 2.1 do lead to analytical approx- imations which are valid over a restricted domain. Consider, a fourth order spline approximation, as specified by Equation 34, which approximates the error function over the range –22 with a relative error bound that is bet- ter than 0.001 and leads to the approximation
2 2 4 4 asin2fot a sin2fot a sin2fot y4t = ------1 – ------++------ 18 1260 (116) 2 2 4 4 6 6 8 8 asin2f t 7a sin2f t 37a sin2f t 4a sin2f t a sin2f t –a2 sin2f t 2 ------o 1 ++------o ------o - ++------o ------o e o 18 420 315 945
The amplitude of the kth harmonic in such a signal is given by
T 1 2 c4 k ==------y4asin2fot sin2kfot dt 2Ty4asin2 sin2k d (117) T 0 0 where the change of variable = fot has been used. The first, third, fifth and seventh harmonic levels are:
2 4 2 2 4 6 8 2 c41 2a a a 2a a 11a 11a a a –2a ------= ------1 – ------+ ------+ ------ I0 ----- 1 ++++------e – T 2 24 2016 2 2 24 105 70 945 (118) 2 2 4 6 8 52a a 1481a 38a 29a a –2a2 ------ I1 ----- 1 +------+++------e 6 2 4200 525 3150 1575
3 2 2 2 4 6 8 2 c4.3 2a a 115 2a a 403a 6a 31a 2a –2a ------= ------1 – ------– ------ I0 ----- 1 ++++------e + T 144 56 84 2 1380 115 5175 5175 (119) 2 2 4 6 8 10 115 2 a 8a 163a 76a 11a a –2a2 ------ I1 ----- 1 +++++------e 21a 2 23 1840 5175 6900 10350
5 2 2 4 6 8 10 2 c45 2a 262 2 a 1943a 1485a 73a 13a a –2a ------= ------+ ------ I0 ----- 1 +------+------+++------e – T 40320 15a 2 7336 29344 11004 22008 33012 (120) 2 2 4 6 8 10 12 1048 2 a 1943a 1201a 5125a 5a 41a a –2a2 ------ I ----- 1 ++++++------e 3 1 15a 2 7336 14672 352128 2751 264096 132048
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 31
2 2 4 6 8 10 12 c –26784 a 779a 631a 2047a 25a 17a a –2a2 ------47 - = ------ I ----- 1 +++------++------+------e – 3 0 T 21a 2 3392 13568 325632 40704 407040 610560 (121) 2 2 4 6 8 10 12 14 27136 2 a 779a 1055a 137a 2269a 67a a a –2a2 ------ I ----- 1 ++------++------+------++------e 5 1 21a 2 3392 13568 10176 1302528 407040 92160 2442240
2 2 The variation, with the input signal amplitude, of the harmonic distortion, as defined by c4 k c41 , is shown in Figure 22. 3rd order
0.010 5th order 0.001
10-4 7th order
10-5
10-6
10-7 0.05 0.10 0.50 1 a Fig. 22. Graph of the variation of harmonic distortion with amplitude.
7.7 Linear Filtering of a Error Function Step Signal
Consider the case of a practical step input signal that is modelled by the error function, erft and the case where such a signal is input to a 2nd order linear filter with a transfer function defined by
–t 1 te 1 Hs= ------ ht= ------ ut = ------(122) s 2 2 2f 1 + ------ p 2fp
Theorem 7.3 Linear Filtering of an Error Function Signal The output of a second order linear filter, defined by Equation 122, to an error function input signal, defined by erft , is
t yt= erf -- ut+
–t 2 2 2 (123) e t t 2 ------ ----- – t + exp------erf ----- – erf ----- – -- – ------exp ------exp – -- – ----- + ------ut 2 2 2 4 2 2 4 2 and can be approximated by the nth order signal
t y t = f -- ut+ n n
–t 2 2 2 (124) e t t 2 ------ ----- – t + exp ------f ----- – f ----- – -- – ------exp ------exp – -- – ----- + ------ut 2 n n 2 2 4 2 2 4 2 where fn is defined by one of the approximations detailed in Theorem 3.1, Theorem 4.1, Theorem 5.1 or Theorem 6.1. It is the case that
lim ynt = yt t 0 (125) n
Proof The proof is detailed in Appendix 7.
© Roy Howard 2020 Print Date: 3/12/20 32 Analytical Approx. for Error Function
7.7.1 Results
For an input signal erft ut , = 12 , input into a second order linear filter with fp = 1 , the output signal is shown in Figure 23. The relative errors in the approximations to the output signal are shown in Figure 24 for the case of approximations as specified by Equation 43 and with the use of optimum transition points.
1.0 input 0.8 output 0.6
0.4
0.2
0.0 0.0 0.5 1.0 1.5 2.0 2.5 3.0 t Fig. 23. Graph of the input signal erft , = 12 and the corresponding approximation to the output of a second order linear filter with fp = 1 , = 12 .
ret
0.010 6 0.001 6 7 10-4 7
-5 10 11 10-6 12
10-7 0.0 0.5 1.0 1.5 2.0 2.5 3.0 t Fig. 24. Graph of the relative errors associated with the output signal, shown in Figure 23, for approximations to the error function (Equation 43) of orders six to twelve which utilize optimum transition points.
7.8 Extension to Complex Case
By definition, the error function, for the general complex case, is defined according to
2 –2 erfz = ------e d z C (126) where the path is between the points zero and z and is arbitrary. For the case of zxjy= + , and a path along the x axis to the point x 0 and then to the point z , the error function is defined according to
x y 2 –2 2j –xj+ 2 erfxjy+ = ------e d + ------e d 0 0 (127) –x2 y –x2 y 2e 2 2je 2 = erfx ++------ e sin2x d ------ e cos2x d 0 0 Explicit approximations for erfxjy+ then arise when integrable approximations for the two dimensional sur- 2 2 faces expy sin2xy and expy cos2xy over 0 x 0 y are available. Naturally, significant existing research exists, e.g. [26].
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 33
7.9 Approximation for the Inverse Error Function
There are many applications where the inverse error function is required and accurate approximations for this function is of interest. From the research underpinning this paper, the authors view is that finding approximations to the inverse error function is best treated directly and as a separate problem, rather than approaching it via find- ing the inverse of an approximation to the error function.
8Conclusion
This paper has detailed analytical approximations for the error function, underpinned by a spline based inte- gral approximation, which have significantly better convergence than the default Taylor series. The original approximations can be improved by utilizing the approximation erfx 1 for xx o , with xo being dependent on the order of approximation. A fourth order approximation, with xo = 2.3715 , achieves a relative error bound –3 of 1.03 10 over the interval 0 . A sixteenth order approximation, with xo = 3.9025 , has a relative error –8 bound of 3.44 10 . Further improvements were detailed via two generalizations. The first was based on utilizing integral approx- imations for each of the m equally spaced sub-intervals in the required interval of integration. The second, was based on utilizing a fixed sub-interval within the interval of integration, with a known tabulated area, and then uti- lizing an integral approximation over the remainder of the interval. Both generalizations led to significantly improved accuracy. For example, a fourth order approximation based on four sub-intervals, with xo = 3.7208 , –7 achieves a relative error bound of 1.43 10 over the interval 0 . A sixteenth order approximation, with –19 xo = 6.3726 , has a relative error bound of 2.01 10 . Finally, it was shown that a custom feedback system, with inputs defined by either the original error function approximations or approximations based on the use of sub-intervals, leads to analytical approximations with improved accuracy and which are valid over the positive real line without utilizing the approximation erfx 1 for x suitably large. The original fourth order error function approximation yields an approximation with a rela- –5 tive error bound of 1.82 10 over the interval 0 . The original sixteenth order approximation yields an –14 approximation with a relative error bound of 1.68 10 . Applications of the approximations were detailed and these include, first, approximations to achieve the spec- –4 –6 –10 –16 ified error bounds of 10 , 10 , 10 and 10 over the positive real line. Second, the definitions of func- tions that are upper and lower bounds, of arbitrary accuracy, for the error function. Third, new series for the error 2 function. Fourth, new sequences of approximations for exp–x which have significantly higher convergence properties that a Taylor series approximation. Fifth, a complementary demarcation function satisfying the con- 2 2 straint eCx +1erf x = was defined. Sixth, arbitrarily accurate approximations for the power and harmonic distortion for a sinusoidal signal subject to a error function nonlinearity. Seventh, approximate expressions for the linear filtering of a step signal that is modelled by the error function.
Acknowledgement
The support of Prof. A. Zoubir, SPG, Technische Universität Darmstadt, Darmstadt, Germany, who hosted a visit where the research for, and the writing of, this paper was completed, is gratefully acknowledged.
Appendix 1: Proof of Theorem 2.1
2 Consider fx= exp–x . Successive differentiation of this function leads to the iterative formula
k 2 f x = pkx exp–x (128) where
1 pkx = p k – 1 x – 2xp k – 1 x p0 x = 1 (129) It then follows from Equation 20 that
© Roy Howard 2020 Print Date: 3/12/20 34 Analytical Approx. for Error Function
x n 2 2 2 k + 1 k k k ------ exp– d ------ cnk x – f + –1 f x k = 0 (130) n 2 k + 1 2 k 2 = ------ cnk x – pk exp– + – 1 pkx exp–x k = 0 The result for the case of = 0 then yields the nth order approximation for the error function:
n 2 k + 1 k –x2 fnx = ------ cnk x pk 0 + –1 pkx e (131) k = 0
1 To determine n x consider the equality erfx = fnx + nx . Differentiation yields
–x2 n 1 2e 2 k k –x2 n x = ------– ------ cnk k + 1 x pk 0 + –1 pkx e – k = 0 (132) –x2 n 2e k + 1 k 1 ------ cnk x –1 p kx – 2xp k x k = 0 and the required result:
–x2 n 1 2e 2 k n x = ------– ------ cnk k + 1 x pk 0 – k = 0 (133) –x2 n 2e k k 2 1 ------ cnk x –1 k + 12– x pkx + xp kx k = 0
Appendix 2: Proof of Theorem 2.2
2 1 1 The use of a Taylor series expansion for exp–x in the definitions of 0 x and 1 x , as defined by Equation 38 and Equation 39, yields:
2 2 4 6 8 10 12 14 1 x 3x 5x 7x 3x 11x 13x x 0 x = ------ 1 – ------++------– ------– ------+------– ------+ 2 6 24 40 720 5040 2688 (134) 2 x 2 k 2k 2 1 = ------ c00 – c01 x ++ –1 c0 kx + c0 k = ---- – ------ k 0 k! k + 1 !
4 4 6 8 10 1 x 2 5x 7x x 11x 1 x = ------ 12– x ++------– ------– ------ (135) 6 4 16 8 420
1 1 From a consideration of 0 x and 1 x , as well as higher order residual functions, it can be readily seen that 1 1 the polynomial terms of order zero to 2n + 1 in n x have coefficients of zero. It then follows that n x can be written as
2n + 2 1 1 x n x = ------------gnx n 012 (136) xn 0 where
2 4 k 2k gnx = 1 – dn 1x ++dn 2x –1 – dnk x + (137) and where it can readily be shown that
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 35
n n n xn 0 = 2 2i + 1 2 n! n 012 (138) i = 0
1 Graphs of the magnitude of the residual functions, n x , for orders zero, two, four, six and eight, are shown in Figure 25. The magnitude of the functions defined by gn , for the same orders, are shown in Figure 26 and it is evident that
gnx ko x 0 n 012 (139) for a fixed constant ko which is of the order of unity. Hence:
2n + 2 1 ko x n x ------ ------x 0 n 012 (140) xn 0
1 n and hence, for n fixed and x 0 fixed, n x is bounded. Further, as xn 0 2 n! , it follows, for all fixed val- ues of x , that
1 limn x = 0 x 0 (141) n The convergence is not uniform. 1 1000 n x 100 n = 4 n = 8 10 n = 2
1 n = 0 0.100 n = 6 0.010
0.001 0 2 4 6 8 10 12 14 x 1 Fig. 25. Graphs of n x for orders zero, two, four, six and eight.
gnx 1
0.100
0.010 n = 0 0.001 n = 6
10-4 n = 2
10-5 n = 8 n = 4 0 2 4 6 8 10 12 14 x
Fig. 26. Graphs of gnx for orders zero, two, four, six and eight. It then follows, for all fixed values of x , that there exists an order of approximation, n , such that the error in 1 the approximation n x can be made arbitrarily small, i.e. o 0 there exists a number Nx such that
1 n x o n Nx (142) In general, Nx increases with x . Thus, 0 there exists a number N x such that o xo o
© Roy Howard 2020 Print Date: 3/12/20 36 Analytical Approx. for Error Function
1 x x 0 x n N x (143) n o o xo o
1 Finally, as n 0 = 0 , for all n , it then follows, for x fixed, that
x 1 nx = n d ox n Nxx (144) 0 which proves convergence.
Appendix 3: Fourth Order Spline Approximation - Sixteen Sub-interval Case Consistent with Theorem 4.1, a fourth order spline approximation, which utilizes sixteen sub-intervals, is
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 37
2 4 x 16x 16x f416 x = ------1 – ------++------16 73728 1 321 205 760 2 2 4 6 8 x –x x 47x x x ------ exp------1 – ------+++------– ------8 256 4608 27 525 120 5 284 823 040 4 058 744 094 720 2 2 4 6 8 x –x x 187x x x ------ exp------1 – ------+++------– ------8 64 4608 27 525 120 1 321 205 760 253 671 505 920 2 2 4 6 8 x –9x x 1261x x 3x ------ exp------1 – ------+++------– ------8 256 4608 82 575 360 587 202 560 150 323 855 360 2 2 4 6 8 x –x x 249x x x ------ exp------1 – ------+++------– ------8 16 4608 9 175 040 330 301 440 15 854 469 120 2 2 4 6 8 x –25x x 389x 5x 125x ------ exp------1 – ------+++------– ------8 256 4608 9 175 040 1 056 964 608 811 748 818 944 2 2 4 6 8 x –9x x 5041x x 3x ------ exp------1 – ------++------– ------+ 8 64 4608 82 575 360 146 800 640 9 395 240 960 2 2 4 6 8 x –49x x 2287x 7x 343x ------ exp------1 – ------++------– ------+ 8 256 4608 27 525 120 754 974 720 579 820 584 960 2 2 4 6 8 x –x x 2987x x x ------ exp------1 – ------++------– ------+ (145) 8 4 4608 27 525 120 82 575 360 990 904 320 2 2 4 6 8 x –81x x 11341x 9x 243x ------exp------1 – ------++------– ------+ 8 256 4608 82 575 360 587 202 560 150 323 855 360 2 2 4 6 8 x –25x x 4667x 5x 125x ------ exp------1 – ------++------– ------+ 8 64 4608 27 525 120 264 241 152 50 734 301 184 2 2 4 6 8 x –121x x 5647x 121x 14641x ------ exp------1 – ------++------– ------+ 8 256 4608 27 525 120 5 284 823 040 4 058 744 094 720 2 2 4 6 8 x –9x x 20161x x 3x ------ exp------1 – ------++------– ------+ 8 16 4608 82 575 360 36 700 160 587 202 560 2 2 4 6 8 x –169x x 2629x 169x 28 561x ------ exp------1 – ------++------– ------+ 8 256 4608 9 175 040 5 284 823 040 4 058 744 094 720 2 2 4 6 8 x –49x x 3049x 7x 343x ------ exp------1 – ------++------– ------+ 8 64 4608 9 175 040 188 743 680 36 238 786 560 2 2 4 6 8 x –225x x 31501x 5x 375x ------ exp------1 – ------++------– ------+ 8 256 4608 82 575 360 117 440 512 30 064 771 072 2 4 6 8 x 2 127x 3929x 79x x ------ exp–x 1 ++------+------+------16 4608 9 175 040 20 643 840 61 931 520
When this approximation is utilized with the transition point xo = 7.1544 , the relative error bound in the approx- –16 imation to the error function, over the interval 0 , is 4.82 10 .
Appendix 4: Proof of Theorem 6.1 Consider the differential equation
ynt + gnt ynt = gnt yn0 = 0 (146) for the case where gn is based on the nth order approximation fn to the error function, defined in Theorem 2.1, and is defined according to
© Roy Howard 2020 Print Date: 3/12/20 38 Analytical Approx. for Error Function
–t2 n 4 –t2 8e k + 1 k –t2 gnt ==------e fnt ------ cnk t pk 0 + –1 pkt e t 0 (147) k = 0 To find a solution to the differential equation for such a driving signal, first note that the solution to the differential 4 –t2 equation for the case of gnt = ------e erft is
2 ynt = 1erf– exp– t (148)
Second, with gn defined by Equation 147, the following signal form
–t2 –2t2 ynt = 1 – exp – pn 0 ++pn 1t e pn 2t e t 0 (149) has potential as a solution for unknown polynomial functions pn 1 and pn 2 and an unknown constant pn 0 . With such a form, the initial condition of yn0 = 0 implies
pn 0 = –pn 10 + pn 20 (150) It is the case that
1 –t2 –t2 1 –2t2 –2t2 ynt = pn 1t e – 2tpn 1t e +1pn 2t e – 4tpn 2t e – ynt (151)
Substitution of ynt and ynt into the differential equation yields
1 –t2 –t2 1 –2t2 –2t2 –t2 –2t2 pn 1t e – 2tpn 1t e + pn 2t e – 4tpn 2t e exp– pn 0 ++pn 1t e pn 2t e + (152) 4 –t2 –t2 –2t2 4 –t2 ------e fnt 1 – exp – pn 0 ++pn 1t e pn 2t e = ------e fnt which implies
1 –t2 –t2 1 –2t2 –2t2 4 –t2 pn 1t e – 2tpn 1t e +0pn 2t e – 4tpn 2t e – ------e fnt = (153) and
1 –t2 –t2 1 –2t2 –2t2 pn 1t e – 2tpn 1t e +=pn 2t e – 4tpn 2t e n (154) 8 –t2 k + 1 k –t2 ---e c t pk 0 + –1 pkt e nk k = 0 Thus:
n 1 8 k + 1 p t – 2tp t = --- c pk 0 t n 1 n 1 nk k = 0 (155) n 1 8 k k + 1 p t – 4tp t = --- c –1 pkt t n 2 n 2 nk k = 0
To solve for the polynomials pn 1 and pn 2 , first note (see Equation 26) that
2 k pkt = ak 0 ++ak 1tak 2t ++ akk t k 01 n (156) for appropriately defined coefficients akj , j 01 k .
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 39
A4.1 Solving for Coefficients of First Polynomial
Substitution of pk 0 from Equation 156, into the differential equation defining pn 1 , yields
n 1 8 k + 1 p t – 2tp t = --- c a t (157) n 1 n 1 nk k 0 k = 0
n + 1 With an 0 = 0 for n odd, the maximum power for t on the right hand side of the differential equation is t , n n even, and t for n odd. Thus, the form required for pn 1 is
n – 1 0 +++1t n – 1t n odd p t = (158) n 1 n +++ t t n even 0 1 n Substitution then yields
n – 1 n – 2 n – 1 8 k + 1 +++2 t n – 1 t – 2t +++ t t = --- c a t n odd 1 2 n – 1 0 1 n – 1 nk k 0 k = 0 (159) n n – 1 n 8 k + 1 +++2 t n t – 2t +++ t t = --- c a t n even 1 2 n 0 1 n nk k 0 k = 0 For the case of n even, equating coefficients associated with set powers of t , yields:
n + 1 8 –4 t :2– = --- c a = ------ c a n nn n 0 n nn n 0 n 8 –4 t :2– = --- c a = ------ c a n – 1 nn – 1 n –01 n – 1 nn – 1 n –01 n – 1 8 n 4 t : nn – 2n – 2 = --- cnn – 2an –02 n – 2 = --- n – --- cnn – 2an –02 2 (160)
2 8 3 4 t :3 – 2 = --- c a = ------3 – --- c a 3 1 n 1 10 1 2 n 1 10 1 8 4 t :2 – 2 = --- c a = – --- c a 2 0 n 0 00 0 2 n 0 00
With the odd coefficients a10 , a30 , , an –01 being zero, it follows that the corresponding odd coefficients n – 1n – 3 1 are also zero. For the even coefficients, the algorithm is:
–4 = ------ c a m nm m 0
m –22i + m –22i + 4 m m – 2i = ------– --- cnm – 2iam –02i i 1 ---- – 1 (161) 2 2 4 = – --- c a 0 2 n 0 00 where mn= . For the case of n being odd, the odd coefficients nn – 2 1 are again zero and the algo- rithm is the same as that specified in Equation 161 with mn= – 1 .
A4.2 Solving for Coefficients of Second Polynomial
Substitution of pkt from Equation 156, into the differential equation defining pn 2 , yields:
© Roy Howard 2020 Print Date: 3/12/20 40 Analytical Approx. for Error Function
n k 1 8 k ki++1 p t – 4tp t = --- c –1 a t (162) n 2 n 2 nk ki k = 0 i = 0
The coefficients aki that are associated with a given power of t are illustrated in Figure 27. It then follows, for a r fixed power of t , say t , that the associated coefficients, aki , are
r r k --- --- + 1 minr – 1 n 2 2 (163) irk= –1–
Thus:
2n + 1 minr – 1 n 1 8 k r p t – 4tp t = --- c –1 a t (164) n 2 n 2 nk kr –1 k– r = 1 r k = --- 2
power of t ann 2n ann – 1 an – 1 n – 1 ann – 2 2n – 2
a n n --- n –1--- – 2 2 a44 an 0 n a43 an –01 n – 1
a22 a31 a40 4 a21 a30 a11 a20 2 a10 a00 k 1 2 3 4 5 n – 2 n – 1 n Fig. 27. Illustration of the coefficients that potentially are non-zero for a set power of t . The illustration is for the case of n = 8 .
With
m pn 2t = 0 +++1t mt (165) the differential equation implies
m – 1 m 1 +++22t mmt – 4t0 +++1t mt
2n + 1 minr – 1 n 8 k r (166) = --- c –1 a t nk kr –1 k– r = 1 r k = --- 2 The requirement, thus, is for m = 2n . Equating coefficients (see Figure 27) yields:
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 41
2n + 1 8 n –2 n t :4– = --- –1 c a = ------ –1 c a 2n nn nn 2n nn nn 2n 8 n –2 n t :4– = --- –1 c a = ------ –1 c a 2n – 1 nn nn – 1 2n – 1 nn nn – 1 2n – 1 8 n – 1 n t :2n – 4 = --- –1 c a + –1 c a 2n 2n – 2 nn – 1 n – 1 n – 1 nn nn – 2
2n2n 2 n – 1 n 2n – 2 = ------– --- –1 cnn – 1an – 1 n – 1 + –1 cnn ann – 2 4 (167) 3 8 2 t :4 – 4 = --- –c a + c a = – --- –c a + c a 4 2 n 1 11 n 2 20 2 4 n 1 11 n 2 20
2 –8 3 2 t :3 – 4 = ------ c a = ------3- + --- c a 3 1 n 1 10 1 4 n 1 10
1 8 2 2 t :2 – 4 = --- c a = ------2- – --- c a 2 0 n 0 00 0 4 n 0 00
As the coefficients ann – 1ann – 3 a10 are zero, the algorithm is:
–2 n = ------ –1 c a 2n nn nn min 2n – 2i n 2n –22i + 2 k = ------2n –22i + - – --- –1 c a i 1 n – 1 2n – 2i 4 nk k 2ni– – k (168) kni= – 2 = -----2 – --- c a 0 2 n 0 00
Appendix 5: Proof of Theorem 7.1 Consider the results stated in Theorem 2.1:
x n 2 –2 2 k + 1 k –x2 erfx = ------ e d ------ cnk x pk 0 + –1 pkx e (169) 0 k = 0 Differentiation then yields
n –x2 k k –x2 e cnk k + 1 x pk 0 + –1 pkx e + k = 0 (170) n k k + 1 1 –x2 –x2 cnk –1 x p kx e – 2xp k x e k = 0 which leads to the required result:
n k cnk k + 1 x pk 0 2 –x k = 0 e ------(171) n k + 1 k 2 1 1 + cnk –1 x pkx k + 12– x + xp kx k = 0
Appendix 6: Proof of Theorem 7.2 Consider the exact result
© Roy Howard 2020 Print Date: 3/12/20 42 Analytical Approx. for Error Function
erfx = f0x + 0x (172)
1 where f0 is specified by Equation 30 and the derivative of the error term, 0 x , is specified by Equation 38. By 2 1 utilizing a Taylor series approximation for exp–x , 0 x can be written as
2 2 4 6 8 k 2k 1 x 3x 5x 7x 9x –1 2k + 1 x 0 x = ------ 1 – ------+++------– ------– ------+ (173) 2 6 24 120 k + 1 ! Integration yields
3 2 4 6 8 k 2k x 1 3x 5x 7x 9x –1 2k + 1 x 0x = ------ --- – ------++------– ------– +------+ (174) 3 25 67 24 9 120 11 2k + 3 k + 1 ! and the following series for the error function then follows:
x x –x2 erfx = ------+ ------ e + (175) 3 2 4 6 8 k 2k x 1 3x 5x 7x 9x –1 2k + 1 x ------ --- – ------++------– ------– +------+ 3 25 67 24 9 120 11 2k + 3 k + 1 ! The series associated with first and second order approximations follow in an analogous manner.
Appendix 7: Proof of Theorem 7.3 The filter output is given by the convolution integral:
t –t – t – e yt= erf --- ------d 2 0 (176) –t t t e = ------ t erf --- e d – erf --- e d 2 0 0 Using the integral results, (e.g. [22], eqn 4.2.1 and eqn 4.2.5)
t 2 2 b 1 bt 1 b b 1 b b erfa e d = ---erfat e – --- exp------erf at – ------+ --- exp------erf –------(177) 2 2 b b 4a 2a b 4a 2a 0
t 2 b 1 1 bt 1 b b 1 b 1 b 2 erfa e d = --- t –erf--- at e –+--- exp ------–erf--- at – ------– ------exp – at – ------ 2 2 b b b 4a 2a b 2a a 2a 0 (178) 2 2 1 b b 1 b 1 –b --- exp ------–erf--- –------– ------exp ------2 2 2 b 4a 2a b 2a a 4a
2 2 2 2 with a = 1 , b = 1 , b 4a = 4 , it then follows that
–t 2 2 te t t t – yt= ------erf -- e – exp------erf -- – ----- +–exp------erf ----- 2 2 2 4 2 4 2
2 2 t t t t 2 t – erf -- e –+exp ------–erf -- – ----- – ------exp – -- – ----- (179) –t 2 2 2 2 e 4 ------2 2 2 2 – – exp ------–erf ----- – ------exp ------2 2 4 2 2 4
Print Date: 3/12/20 © Roy Howard 2020 Analytical Approx. for Error Function 43
Simplifying, and using the fact that the error function is an odd function, yields the required result:
t yt= erf -- +
–t 2 2 2 (180) e t t 2 ------ exp ------–erft + ----- – erf ----- – -- – ------exp ------exp – -- – ----- + ------2 2 4 2 2 2 4 2 To prove convergence, consider
t t lim ynt ==lim fn --- ht– d erf --- ht– d (181) n n 0 0 where lim fnx = erfx and h is the impulse response of the second order filter. The interchange of limit and n integration is valid, consistent with Lemma 2, as the integrand comprises of differentiable bounded functions.
9 References
[1] Abramowitz, M. & Stegun I. A. (Eds), Handbook of Mathematical Functions with Formulas, Graphs and Mathematical Tables, (1964), Dover. [2] Abuelma'atti, M T., A note on the harmonic distortion in AC-bias recording, IEEE Transactions on Magnetics, vol. 24, no. 6, (1988), pp. 3259-3260. [3] Alzer, H., Error function inequalities, Advances in Computational Mathematics, vol. 33, (2010), pp. 349– 379, doi:10.1007/s10444-009-9139-2. [4] Champeney, D. C., A Handbook of Fourier Theorems, (1987), Cambridge University Press. [5] Chiani, M. & Dardari, D, Improved exponential bounds and approximation for the Q-function with application to average error probability computation, Global Telecommunications Conference, GLOBECOM '02, IEEE, Taipei, Taiwan, vol. 2, (2002), pp. 1399-1402, doi: 10.1109/ GLOCOM.2002.1188428. [6] Chevillard, S., The functions erf and erfc computed with arbitrary precision and explicit error bounds, Information and Computation, vol. 216, (2012), pp. 72-95. [7] Chu, J. T., On bounds for the Normal integral, Biometrika, vol. 42, no. 1/2, (1955), pp. 263-265. [8] Cody, W. J., Rational Chebyshev approximations for the error function, Mathematics of Computation, vol. 23, (1969), pp. 631–637. [9] De Schrijver, S. K., Aghezzaf, E. & Vanmaele, H., Double precision rational approximation algorithms for the standard normal first and second order loss functions, Applied Mathematics and Computation, vol. 219, (2012), pp. 2320-2330, doi: /10.1016/j.amc.2012.08.012. [10] Fujiwara, T., Wavelength response of harmonic distortion in AC-bias recording, IEEE Transactions on Magnetics, vol. 16, no. 3, (1980), pp. 501-506. [11] Howard, R. M., Dual Taylor series, spline based function and integral approximation and applications, Mathematical and Computational Applications, vol. 24, 35, (2019), doi: 10.3390/mca24020035. [12] Klein, S. A., Measuring, estimating, and understanding the psychometric function: a commentary, Perception and Psychophysics, vol. 63, no. 8, (2001), pp. 1421-55. [13] Lebedev, N. N., Special Functions and their Applications, (1971), Dover, section 2.6. [14] Lee, J. S. & Woodring, D. G., Considerations of nonlinear effects in phase-modulation systems, IEEE Transactions on Communications, vol. 20, no. 6, (1972), pp. 1063-1073. [15] Li, W., Damage models for soft tissues: A survey, Journal of Medical and Biomedical Engineering, vol. 36, (2016), pp. 285–307, doi: 10.1007/s40846-016-0132-1. [16] Marsaglia, G., Evaluating the normal distribution, Journal of Statistical Software, vol. 11, no. 4, (2004), pp.1- 11. [17] Matíc, I., Radoičić, R. & Stefanica, D., A sharp Pólya-based approximation to the normal CDF, Applied Mathematics and Computation, vol. 322, (April 2018), pp. 111–122, doi: /10.2139/ssrn.2842681. [18] Menzel, R., Approximate closed form solution to the error function, American Journal of Physics, vol. 43, (1975), pp. 366-367, doi: 10.1119/1.10085. [19] Menzel, R., Erratum: Approximate closed form solution to the error function, American Journal of Physics, vol. 43, (1975), p. 923, doi: 10.1119/1.10112.
© Roy Howard 2020 Print Date: 3/12/20 44 Analytical Approx. for Error Function
[20] Nandagopal, M., Sen, S., & Rawat, A., A note on the Error function, Computing in Science & Engineering, vol. 12, no. 4, (2010), pp. 84-88, doi: 10.1109/MCSE.2010.79. [21] Neuman, E., Inequalities and bounds for the incomplete Gamma function, Results in Mathematics, vol. 63, (2013), pp. 1209–1214, doi: 10.1007/s00025-012-0263-9. [22] Ng, E. W. & Geller, M., A table of integrals of the error functions, Journal of Research of the National Bureau of Standards - B: Mathematical Sciences, vol. 73B, no. 1, January-March, (1969), pp. 1-20. [23] Ogden, R. W. & Roxburgh, D. G., A pseudo-elastic model for the Mullins effect in filled rubber, Proceedings of the Royal Society of London, Series A: Mathematical, Physical and Engineering Sciences, vol. 455, (1999), pp. 2861–2877. [24] Rinderknecht, M. D., Lambercy, O. & Gassert, R., Performance metrics for an application-driven selection and optimization of psychophysical sampling procedures, PLoS ONE, vol 13, no. 11, article ID: e0207217 (2018), doi: 10.1371/journal.pone.0207217. [25] Sandoval-Hernandez, M. A., Vazquez-Leal, H., Filobello-Nino, U. & Hernandez-Martinez, L., New handy and accurate approximation for the Gaussian integrals with applications to science and engineering, Open Mathematics, vol. 17, (2019), pp. 1774-1793, doi: 10.1515/math-2019-0131. [26] Salzer, H. E., Formulas for calculating the Error function of a complex variable, Mathematical Tables and Other Aids to Computation, vol. 5, no. 34, (1951), pp. 67-70. [27] Schöpf, H. M. & Supancic, P. H., On Bürmann’s theorem and its application to problems of linear and nonlinear heat transfer and diffusion: Expanding a function in powers of its derivative, The Mathematica Journal, vol. 16, (2014), pp. 1-44. [28] Shi, Q., OFDM in bandpass nonlinearity, IEEE Transactions on Consumer Electronics, vol. 42, no. 3, (1996), pp. 253-258, doi: 10.1109/30.536045. [29] Soranzo, A., & Epure, E., ‘Simply explicitly invertible approximations to 4 decimals of error function and normal cumulative distribution function’, (2012), arXiv:1201.1320v1. [30] Taggart, D., Kumar, R., Raghavan, S., Goo, G., Chen, J. & Krikorian, Y., Communication system performance - detailed modeling of a power amplifier with two modulated input signals, 2005 IEEE Aerospace Conference, Big Sky, MT, (2005), pp. 1398-1409, doi: 10.1109/AERO.2005.1559430. [31] Temme, N. M., Error Functions, Dawson's and Fresnel Integrals, ch. 7, NIST Handbook of Mathematical Functions, Editors: Olver, F. W., Lozier, D. W., Boisvert, R. F., & Clark, C. W., National Institute of Standards and Technology and Cambridge University Press (2010). [32] Vazquez-Leal, H., Casteneda-Sheissa, R., Fibello-Nino, U., Sarmiento-Reyes, A., & Orea, J. S., High accurate simple approximation of normal distribution integral, Mathematical Problems in Engineering, Article ID: 124029, (2012), doi: 10.1155/2012/124029. [33] Vedder, J. D., Simple approximations for the error function and its inverse, American Journal of Physics, vol. 55, (1987), pp. 762-763, doi: 10.1119/1.15018. [34] Winitzki, S., A handy approximation for the error function and its inverse, https://scholar.google.com/ citations?user=Q9U40gUAAAAJ&hl=en&oi=sra, (2008), accessed 10 Nov 2020. [35] Yang, Z. & Chu, Y., On approximating the error function, Journal of Inequalities and Applications, article 311, (2016), doi: 10.1186/s13660-016-1261-3. [36] Yang, Z., Qian, W., Chu, Y., & Zhang, W., On approximating the error function, Mathematical Inequalities and Applications, vol. 21, no. 2, (2018), pp. 469-479, doi:10.7153/mia-2018-21-32.
Print Date: 3/12/20 © Roy Howard 2020