NOLTA, IEICE Paper
A fast verified automatic integration algorithm using double exponential formula Naoya Yamanaka 1 a) , Tomoaki Okayama 2 , Shin’ichi Oishi 3 , and Takeshi Ogita 4 1
Waseda University, Tokyo, Japan
2
The University of Tokyo, Tokyo, Japan
3
Waseda University and CREST, JST, Tokyo, Japan
4
Tokyo Woman’s Christian University, Tokyo, Japan
a)
naoya
[email protected]
Abstract: A fast verified automatic integration algorithm is proposed for calculating univariate integrals over finite intervals. This algorithm is based on the double exponential formula proposed by Takahasi and Mori. The double exponential formula uses a certain trapezoidal rule. This trapezoidal rule is determined by fixing two parameters, the width h of a subdivision of a finite interval and the number n of subdivision points of this subdivision. A theorem is presented for calculating h and n as a function of a given tolerance of the verified numerical integration of a definite integral. An efficient a priori method is also proposed for evaluating function calculation errors including rounding errors of floating point calculations. Combining these, a fast algorithm is proposed for verified automatic integration. Numerical examples are presented for illustrating effectiveness of the proposed algorithm. Key Words: numerical integration, automatic integration, the double exponential formula, verified numerical computation
1. Introduction This paper is concerned with a verified numerical computation of the definite integral over finite interval. The purpose of this paper is to present an efficient automatic inclusion algorithm for a certain class of definite integrals. A type of integrals considered in this paper is as follows: b b g(x) f (x)dx = dx. (1) I= 1−α (b − x)1−β a a (x − a) Here, g(x) = f (x)(x − a)α−1 (b − x)β−1 is assumed to be a certain well-behaved function defined precisely below and α, β be the positive constants. It has been shown that the double exponential formula proposed by Takahasi and Mori [1] is one of the most efficient methods of calculating an approximate value of this type of integrals. The idea of the double exponential formula is to transform a given problem into an integral over (−∞, ∞) via a change of variable x = ϕ(t) as 119 [Received: January 12, 2010. Revised: April 26, 2010. Published: October 1, 2010.] [DOI: 10.1587/nolta.1.119]
Nonlinear Theory and Its Applications, IEICE, vol. 1, no. 1, pp. 119N132
©IEICE 2010
b
∞
f (x)dx =
f (ϕ(t)) ϕ (t)dt.
(2)
−∞
a
Then, the integral on the right hand side of Eq. (2) is evaluated by the trapezoidal formula. For the function ϕ(t), an appropriate double exponential transformation such as ϕa,b (t) =
π a+b b−a tanh sinh t + 2 2 2
(3)
is used, which is an origin of the name of the double exponential formula. Thus, the double exponential formula is explicitly written like
b a
f (x)dx ≈ h
N
f (ϕa,b (kh)) ϕa,b (kh).
k=−M
The error analysis of the double exponential formula has been presented by several authors [1]-[3]. These investigations are done basically for identifying the rates of convergence, and several constants in these error formula were left unevaluated. Recently, Okayama et al. [5] have given an error formula in which all constants are explicitly given. This result is very useful to evaluate an upper bound of the approximation error of the double exponential formula. In this paper, we assume that a tolerance of numerical integration error is given. Then, based on Okayama’s theorem, we present a theorem which gives a method of selecting two parameters h and n so as to keep the approximation error of the double exponential formula to be within this tolerance. Here, h and n are the width of a subdivision of a finite interval and the number of subdivision points of this subdivision of the trapezoidal formula appearing in the double exponential formula, respectively. Then, based on this theorem, we propose an automatic inclusion algorithm for Eq. (1) . Here, the automatic inclusion algorithm means an algorithm calculating an interval I˜ s.t. b I − I˜ rad(I) ˜ ˜ f (x)dx ∈ I, εrel , I= I |I| a ˜ denotes the radius of I. ˜ Namely, based on the circle where εrel is a given relative tolerance and rad(I) interval arithmetic on the complex plane, an algorithm is presented for evaluating truncation errors of the double exponential formula. Then, an efficient a priori method is also proposed for evaluating function calculation errors including rounding errors of floating point calculations. Combining these, a fast algorithm is proposed for verified automatic integration. By numerical experiments it is shown that the proposed algorithm is efficient, i.e. we will present numerical examples which show inclusions for the definite integrals by our proposed algorithm can be obtained with less computational time than that for obtaining approximate values of the integrals by a widespread approximation software developed by Ooura [10] provided that the same relative tolerance is posed.
2. Error analysis of double exponential formula 2.1 Preliminary In this paper, we are concerned with a problem of calculating an inclusion of the definite integral defined by Eq. (1) within a given tolerance. We assume that the integrand f (x) is a function on an open interval (a, b) and may have an integrable singularity at the end-points x = a and/or x = b. The precise restrictions on f are described in the below. We apply a variable transformation x = ϕ(u) to Eq. (1), where ϕ(u) is an analytic function on the real axis (−∞, ∞). Moreover, we assume that ϕ(x) satisfies 120
ϕ(x) < ϕ(y) for x < y and a = ϕ(−∞), Then, we have
∞
I=
b = ϕ(+∞).
f (ϕ(u))ϕ (u)du,
(4)
−∞
in which f (ϕ(u))ϕ (u) has no singularities on the real axis except infinity. If we apply the trapezoidal rule to Eq. (4) with a mesh size h, we have an approximation of the definite integral defined by Eq. (1) as ∞ f (ϕ(kh))ϕ (kh). Ih := h k=−∞
The infinite sum is appropriately truncated in actual numerical computation. Thus, Ih is further approximated by n f (ϕ(kh))ϕ (kh). (5) Ih,n := h k=−n
Here, n is a suitable positive integers and h is a positive constant corresponding a width of the subdivided interval. Let d be a positive constant. We define a domain Dd by Dd = {z ∈ C : |Im z| < d} .
Then, it follows that ϕ (Dd ) = z ∈ C : ϕ−1 (z) ∈ Dd ⎧ ⎫ ⎤ ⎡ 2 ⎨ ⎬ 1 z−a z−a 1 ⎦ < d . = z ∈ C : arg ⎣ loge + 1+ loge ⎩ ⎭ π b−z π b−z We define the following function space [5]: Definition 1 Let K, α, β be positive constants. Then LK,α,β (ϕ (Dd )) denotes the family of all functions f that are holomorphic on ϕ (Dd ) for d with 0 < d < π/2, and satisfy the condition that |f (z)| K |z − a|
α−1
|b − z|
β−1
,
(6)
for all z ∈ ϕ (Dd ). Remark 1 1. Let K, α, β be positive constants. In the following, we assume that g is holomorphic on ϕ (Dd ) for d with 0 < d < π/2, and satisfy the condition that |g (z)| K, for all z ∈ ϕ (Dd ). Then f ∈ LK,α,β (ϕ (Dd )). 2. Eiermann [6] has presented a method for calculating an upper bound of K using circle interval arithmetic. For the type of integral Eq. (1), the following formulation is often used: ∞ g(ϕ(u))Φ(u)du, I= −∞
121
(7)
where Φ(u) =
π 2
b−a 2
α+β−1
α
β
cosh(u) (1 + ϕ−1,1 (u)) (1 − ϕ−1,1 (u)) ,
and ϕ−1,1 (u) is defined by Eq. (3). The formulation is directly derived from ϕ (u) =
π(b − a) cosh(u) (1 + ϕ−1,1 (u)) (1 − ϕ−1,1 (u)) . 4
Thus, I is approximated by Ih,n = h
n
g(ϕ(kh))Φ(kh).
(8)
k=−n
Eq. (5) and Eq. (8) are the same mathematical calculation, but rounding errors of the calculation by Eq. (8) are expected to be less than that by Eq. (5). Now, we consider the estimatation of an error |I − Ih,n |. We divide the error into two parts: |I − Ih,n | |I − Ih | + |Ih − Ih,n |. We introduce notations ED (h) and ET (h, n) by ED (h) = |I − Ih | and ET (h, n) = |Ih − Ih,n |, respectively. ED (h) and ET (h, n) are called a discretization error and truncation error, respectively. Obviously, we have |I − Ih,n | ED (h) + ET (h, n). Formulae for bounding ED (h) and ET (h, n) have been developed by several authors. Usually, these error formulae include some constants. Previously, these constants are not given explicitly. In order to develop an inclusion algorithm, all constants appearing in the error formulae should be explicitly given. Very recently, Okayama et al. have given error formulae for estimating the discretization error and the truncation error, in which all constants are explicitly given. We now briefly review Okayama et al.’s results in order. Okayama et al. give an error formula for estimating the discretization error as follows: Lemma 1 (Okayama et al. [5, Lemma 4.16]) Let f ∈ LK,α,β (ϕ(Dd )) and μ = min {α, β}. Then b ∞ f (x)dx − h f (ϕ (jh)) ϕ (jh) |ED | = a j=−∞ C 1 C2
e−2πd/h , 1 − e−2πd/h
where the constants C1 and C2 are defined by 2K(b − a)α+β−1 , μ 2 C2 = . π α+β cos ( 2 sin d) cos d C1 =
(9) (10)
The following lemma proposed by Okayama et al. is useful for estimating the truncation error: 122
Lemma 2 (Okayama et al. [5, Lemma 4.17]) Assume that the assumptions of Lemma 1 are fulfilled. Furthermore let ν = max {α, β}, n be a positive integer, and M and N be positive integers defined by (if μ = α), M = n, N = n − loge (β/α)/h (11) (if μ = β). N = n, M = n − loge (α/β)/h Then, it follows that −M −1 ∞ |ET | h f (ϕ (jh)) ϕ (jh) + h f (ϕ (jh)) ϕ (jh) j=−∞ j=N +1 π
π
≤ e 2 ν C1 e− 2 μ exp(nh) , where the constant C1 is defined by Eq. (9). Using the above two lemmas, Okayama et al. has proposed the following theorem: Theorem 1 (Okayama et al. [5, Theorem 2.11]) Let f ∈ LK,α,β (ϕ(Dd )), μ = min {α, β}, ν = max {α, β}, n be a positive integer with n (νe) /(4d), and h be selected by loge (4dn/μ) . (12) h = p(n) = n Furthermore, let M and N be positive integers defined by Eq. (11). Then it follows that N b f (x)dx − h f (ϕ(kh)) ϕ (kh) |ED | + |ET | a k=−M π C2 2ν + e (13) C1 e−2πdn/ log(4dn/μ) , π 1 − e− 2 μe where the constants C1 and C2 are defined by Eq. (9) and Eq. (10).
2.2 Main theorem We now consider the problem of constructing an inclusion algorithm using Okayama et al.’s formulae reviewed in the previous subsection. More concretely, we will consider a problem that for a given tolerance, choose suitable h and n such that the upper bounds of the errors ED and ET become the same order and |ED | + |ET | is below the tolerance. To solve this problem, we present the following theorem: Theorem 2 Let f ∈ LK,α,β (ϕ(Dd )), μ = min {α, β} and ν = max {α, β}. Let εabs be positive constants. Furthermore, M and N be positive integers defined by Eq. (11), and the constants C1 and C2 be defined by Eq. (9) and Eq. (10). If a positive number h and a positive integer n are selected as
then
2πd
, 2C2 loge 1 + εabs π ν 1 2 2e 2 n= loge loge , h πμ εabs h=
N b f (x)dx − h f (ϕ(kh)) ϕ (kh) C1 εabs a k=−M
holds. 123
(14)
Proof. Clearly it follows from Lemma 1 and 2 that |ED | + |ET | C1 C2
π π e−2πd/h + e 2 ν e− 2 μ exp(nh) 1 − e−2πd/h ˜D + E ˜T ), = C1 ( E
˜T are defined by ˜D and E where E e−2πd/h , 1 − e−2πd/h ˜T = e π2 ν e− π2 μ exp(nh) . E
˜ D = C2 E
(15) (16)
Here, if we put ˜D εabs , E 2 εabs ˜ ET , 2 then, we have
(17) (18)
˜D + E ˜T C1 εabs . |ED | + |ET | C1 E
˜D depends on only h, from Eq. (17) and the of definition E ˜D , we have Since E C2
e−2πd/h εabs , 2 1 − e−2πd/h
which is equivalent to e−2πd/h
εabs . 2C2 + εabs
From this, it is seen that if h is chosen as
h loge
2πd 2C2 1+ εabs
=: hm ,
then the inequality Eq. (17) is satisfied. ˜T , it is seen that the inequality Eq. (18) is satisfied if Now, from the definition of E π
π
e 2 ν e− 2 μ exp(nhm ) is fulfilled. This is equivalent to
εabs 2
εabs π − μ exp(nh) loge π ν , 2 2e 2
which is further rewritten as 1 n loge h
π
2 2e 2 ν loge πμ εabs
.
Since the right-hand side is monotone decreasing for h, if we put π 2 1 2e 2 ν loge loge , n= h πμ εabs it follows that the inequality Eq. (18) is satisfied. Combining these results, it turns out that the required inequality (14) is proved. Let us explain the difference between Theorem 1 and 2. Both theorems can be used to calculate h ˜T become ˜D and E and n if the tolerance is given. However, if one uses Theorem 1, the decay rates of E different. On the other hand, the choice of h and n in Theorem 2 is designed in order that ED ∼ = ET holds. To show this more concretely, we consider the case of d = 1.0 and α = β = 1. Assume that an 124
absolute tolerance εabs is given. Then, we calculate h1 and n1 based on Theorem 1 so that the error of numerical integration becomes this tolerance. Similarly, we calculate h2 and n2 based on Theorem 2 so that the error of numerical integration becomes this tolerance. Then, we calculate ˜D (hi , ni ) E , i = 1, 2. (19) Ri (εabs ) = log10 ˜T (hi , ni ) E Figure 1 shows a graph of Ri , (i = 1, 2). This figure shows that R1 becomes larger when εabs decreases. On the other hand, R2 keeps almost the value 1 when εabs decreases. 300 R (Theorem 1) 1
R (Theorem 2 [Proposed] )
The ratio of the order R
250
2
200
150
100
50
0 0
Fig. 1.
5
10 15 20 −x Absolute Tolerance [10 ]
25
Comparison between R1 and R2 defined by Eq. (19).
For this reason, we can show that n2 can be chosen much smaller than n1 . From Eq. (13), n1 can be calculated as 1 πμ loge (C3 εabs ) W , (20) n1 = 2πd loge (C3 εabs ) where the constant W (z) is Lambert’s W function and C3 is defined by π C2 ν 2 C3 = 1/ +e . π 1 − e− 2 μe On the other hand, from Eq. (14), n2 can be calculated as π ν 1 2 2e 2 2C2 loge 1 + loge n2 = loge . 2πd εabs πμ εabs
(21)
We consider the case of K = 105 and K = 1020 . We set further d = 1.0 and α = β = 0.5. Figures 2 and 3 show the graphs of n1 and n2 versus given tolerances. This figure demonstrates that n2 can be chosen much smaller than n1 when K is large. Remark 2 1. By our experiments, if f is not so complicated, values of K usually distribute between 0 to 1020 . This is because the value of K increase exponentially when the area, on which g should be holomorphic, is increase. For instance, in Examples 1 and 2 considered in Section 5, the values of K becomes around 102 and 105 , respectively. For more complex integrands, K may easily become much larger as 1015 . 2. When K is not so large, the difference between n1 and n2 is not so much. However, even in such a case, it is easy to see that n2 is always less than n1 . 125
50 n (Theorem 1) 1
45
n2 (Theorem 2 [Proposed] )
The Numbers of Points
40 35 30 25 20 15 10 5 0
5
10 Absolute Tolerance [10−x]
15
Fig. 2. Comparison between n1 and n2 defined by Eq. (20) and Eq. (21) (K = 105 ). 100 n1 (Theorem 1)
The Numbers of Points
90
n2 (Theorem 2 [Proposed] )
80
70
60
50
40 0
5
10 Absolute Tolerance [10−x]
15
Fig. 3. Comparison between n1 and n2 defined by Eq. (20) and Eq. (21) (K = 1020 ).
3. Rounding error analysis In verified numerical computations, all rounding errors that occur throughout the algorithm must be taken into account. Although the rounding errors can be calculated by interval arithmetic, it is much slower than pure floating-point arithmetic. To overcome this problem, we adopt an algorithm of calculating a priori error bounds of function evaluations using floating-point computations, which is proposed by M. Kashiwagi [12]. For a given function f , this algorithm calculates for any a x b a global constant ε satisfying max |ffl (x) − f (x)| ε,
axb
where ffl (x) denotes the approximate value of f (x) calculated by floating point number operations. Since the numerical integration algorithm computes function values at a number of different points, one can expect that the algorithm evaluating the function by pure floating-point number operations with a priori error bound ε becomes much faster than the algorithm based on interval arithmetic. Now, let us briefly explain Kashiwagi’s method. This method is based on the concept of “operator 126
overloading.” Assume that a function f (x) can be calculated by the algorithm recursively using (1) the four arithmetic {+, −, ×, /}, (2) elementary functions such as sin, cos, exp, log and so on, (3) and composite function. Then, consider the data type (J, ε), where J is an interval and ε is a positive number. For this data type, the four arithmetic is defined by (1) (addition) (J1 , ε1 ) + (J2 , ε2 ) = (J1 + J2 , fl+ (ε1 + ε2 + εM |J1 + J2 |)) , (2) (subtraction) (J1 , ε1 ) − (J2 , ε2 ) = (J1 − J2 , fl+ (ε1 + ε2 + εM |J1 − J2 |)) , (3) (multiplication) (J1 , ε1 ) · (J2 , ε2 ) = (J1 · J2 , fl+ (ε1 |J2 | + ε2 |J1 | + εM |J1 · J2 |)) , (4) (division) (J1 , ε1 ) / (J2 , ε2 ) = J1 /J2 , fl+ ε1 |1/J2 | + ε2 J1 /J22 + εM |J1 /J2 |
,
where εM denotes the unit roundoff, for example, in the double precision format of the IEEE 754 floating point number standard, εM is 2−53 . The notation fl+ (formula) and fl− (formula) mean that the formula inside the parenthesis is calculated by the floating point arithmetic under the rounding toward +∞ and −∞ modes, respectively. For J1 = [a, b], J2 = [c, d] and ∗ ∈ {+, −, ·, /}, J1 ∗ J2 means the machine interval arithmetic defined by J1 + J2 = [fl− (a + c) , fl+ (a + c)] , J1 − J2 = [fl− (a − d) , fl+ (b − c)] , J1 · J2 = [min A− , max A+ ] , A+ = {fl+ (ac), fl+ (ad), fl+ (bc), fl+ (bd)}, A− = {fl− (ac), fl− (ad), fl− (bc), fl− (bd)} , J1 /J2 = [min B− , max B+ ] , B+ = {fl+ (a/c), fl+ (a/d), fl+ (b/c), fl+ (b/d)}, B− = {fl− (a/c), fl− (a/d), fl− (b/c), fl− (b/d)} . Here, in the definition of J1 /J2 , we assume that 0 ∈ J2 . Let g(x) being a continuously differentiable function g(x). Then, g((J, ε)) is defined as g((J, ε)) = (g(J), ε |g (J)| + εM |g(J)|). Here, we assume that we have a software library which evaluate the function g with the following accuracy: |gfl (x) − g(x)| |g(x)|εM , where gfl (x) is an evaluated value of g(x) by this library using the floating point operations. It is known that CRlibm library [8] fulfills this requirement for a number of elementary functions. Let us assume that a program language supporting “operator overloading” such as C++, MATLAB is used. Then, for a given function f , the following bottom-up algorithm using the object (J, ε) calculates a global constant ε satisfying max |ffl (x) − f (x)| ε :
axb
127
Algorithm 1 Computation of an a priori error bound of rounding errors when evaluating f (ξ) by the floating-point operations (a ξ b, ξ ∈ F). Step 1 Set an interval J = [a, b]. Step 2 Put x = (J, max (|a|, |b|) εM ). Step 3 Calculate (Jy , εy ) = f (x) using “operator overloading”. Step 4 Output εy .
4. Fast verified automatic integration algorithm Summarizing the above mentioned discussions, we propose the fast verified automatic integration algorithm. For this purpose, we introduce a function calculating the constants appearing in Theorem 2. To describe this function, we use MATLAB-like programming description. function Ic = CondTheorem(ε, C 2 , C 2 , α, β, d) μ = min{α, β}; ν = max{α, β}; 2πd ; 2[C 2 , C 2 ] loge 1 + ε π ν 1 2 2e 2 n= loge loge ; πμ ε [h, h] if μ = α,
[h, h] =
M = n; N = n − fl− (loge (β/α)/h); end; if μ = β, M = n − fl− (loge (α/β)/h); N = n; end;
Ic = fl h
N
f (ϕ(ih)) ϕ (ih) ;
i=−M
Here, fl (formula) means that the formula inside the parenthesis is calculated by the floating point calculations under the rounding to the nearest mode. We assume that in this function description if the formula includes intervals, its value is evaluated as an interval using interval arithmetic. Now, we propose the following fast verified numerical inclusion algorithm for the definite integral (1) : Algorithm 2 (Fast Verified Automatic Integration Algorithm) Consider the definite integral (1). Namely, assume that the functional form of g and the constants α and β expressing the singularities of the integrand f are given. Assume further that a relative tolerance of numerical integration error εrel is given. If |I| is greater than a certain upper bound of rounding errors, then this verified automatic integration algorithm outputs an approximate value Ic satisfying I − Ic I εrel . Otherwise, it outputs Ic satisfying 128
|I − Ic | C. Here, C is a certain constant proportional to a certain bound of rounding errors. Step 1 Calculate an upper bound of rounding error Er for evaluating the function g (ϕ(t)) Φ(t) of Eq. (7) using Algorithm 1. Here, for the calculation g (ϕ(t)), J = [−3.2, 3.2] is inputted for Algorithm 1 because Φ(x) becomes zero for any x satisfying |x| > 3.2. Put Er∗ = rad(J) × Er = 6.4Er . Step 2 Choose d and calculate K. For the evaluations of K, one can use the circle interval arithmetic on complex plane [6]. Evaluate C1 =
2K(b − a)α+β−1 μ
and C2 =
cosα+β ( π2
2 sin d) cos d
by the interval arithmetic and get an inclusion as C1 ∈ [C 1 , C 1 ] and C2 ∈ [C 2 , C 2 ]. Step 3 Set ε = fl− (Er∗ /C 1 ). Then, calculate [Ic , e, s] = InclusionIntegral(εrel , ε, C 1 , C 2 , C 2 , α, β, d). Here, MATLAB’s program like pseudo code for InclusionIntegral is given as function [Ic , e, s] = InclusionIntegral(εrel , ε, C 1 , C 2 , C 2 , α, β, d) while 1, Ic = CondTheorem(ε, C 2 , C 2 , α, β, d); e = fl+ (Er∗ + C 1 ε); If |Ic | > e, 1 εrel (|Ic | − e) ε = fl− · ; 2 C1 e = fl+ (Er∗ + ε); If ε > Er∗ , Ic = CondTheorem(ε, C 2 , C 2 , α, β, d) s = 1; else, Ic = CondTheorem(Er∗ , C 2 , C 2 , α, β, d) s = 0; end; break; else, ε = ε · εrel
If Er∗ > fl+ C 1 ε , e = fl+ (Er∗ + C 1 ε);
Ic = CondTheorem(fl− Er∗ /C 1 , C 2 , C 2 , α, β, d) s = 0; break; end; end; end; 129
Remark 3 1. The constant d determines the region Dd on which we evaluate K by, for example, Eiermann’s method [6]. Of course, the choice of d is not determined uniquely. Thus, for instance, d is assumed to be 1.0 in our implementation. If K becomes to large, the integral interval is subdivided. This is repeated using a kind of bisection technique. This kind of technic is proposed by K. Petras [7]. Thus, the constant d in the numerical examples presented in the next chapter is chosen as 1.0. 2. Let Ic = CondTheorem(ε, C 2 , C 2 , α, β, d). Since h(M + N )Er
Er∗ ,
Theorem 2 asserts that |I − Ic | fl+ (h(M + N )Er + C 1 ε) fl+ (Er∗ + C 1 ε).
3. If the function InclusionIntegral returns s = 1, then I − Ic e e I |I| | |Ic | − e| εrel holds. If s = 0 is returned, the following holds: |I − Ic | e 2Er∗ .
5. Numerical results In this section, we present the numerical experiments. These experiments have been done by a computer having Intel Core 2 Extreme 3.0 GHz CPU with 8G Byte Memory. We use C++ language (GCC 4.1.2 with CRlibm 1.0 beta [8]) under the Fedora Core 8 Linux operating system. We use only 1-core of the CPU. We compare the computational costs of the following three algorithms on automatic integration: (A) proposed verified inclusion algorithm (Algorithm 2), (B) a verification algorithm consists of interval arithmetic and Theorem 2, (C) and the automatic integration software developed by T. Ooura [10]: Algorithms (A) and (B) are verified. Thus, these algorithms give approximation values of the definite integral (1) together with mathematically correct error bounds. On the other hand, although Ooura’s algorithm (C) usually gives accurate approximate values of the definite integral (1), the mathematical correctness of error bounds are not guaranteed in case of (C). The difference between Algorithms (A) and (B) is as follows: Algorithm (B) uses the interval arithmetic to estimate rounding errors. Algorithm (A) uses the a-priori rounding error estimate to avoid time consuming interval arithmetic for the function evaluations of the integrand.
5.1 Example 1
1
x25 + x24 + · · · + x + 1 exp(x) √ dx. x 0 From the functional form of f , α and β are given as α = 0.5 and β = 1.0. Furthermore, as mentioned in the remark after Algorithm 2 d is chosen as 1.0. We note that Algorithms (A) and (B) are stopped if the error bounds become less than given relative tolerances. While Algorithm (C) is stopped if approximate error bounds become less that a given relative tolerances. This is same in the next Example. Figure 4 shows a comparison of the execution time of Algorithms (A)-(C) for I1 . From this, it is seen that the computational time for Algorithm (A) is 3-10 times faster than that for Algorithm (B) provided that the same relative tolerance is posed. Also, it is seen that the computational time for Algorithm (A) is almost the same as that for Algorithm (C). I1 =
130
1.6
x 10
−3
(A) Proposed verified inclusion algorithm (Algorithm 2) (B) A verification algorithm consists of interval arithmetic and Theorem 2 (C) The automatic integration software developed by T. Ooura
1.4
Execution Time [s]
1.2 1 0.8 0.6 0.4 0.2 0
2
4 6 8 10 −x Relative Tolerance (Error Bound for (A) and (B)) [10 ]
Fig. 4.
12
The execution time of Example1.
5.2 Example 2
I2 =
1 0
sin(exp(x)) √ dx x
In this example, α = 0.5, β = 1.0 and d = 1.0. Figure 5 shows a comparison of the execution time of Algorithms (A)-(C) for I2 . From this, it is seen that the computational time for Algorithm (A) is 3-10 times faster than that for Algorithm (B) provided that the same relative tolerance is posed. Also, it is seen that the computational time for Algorithm (A) is almost the same as that for Algorithm (C). x 10
Execution Time [s]
3
−4
(A) Proposed verified inclusion algorithm (Algorithm 2) (B) A verification algorithm consists of interval arithmetic and Theorem 2 (C) The automatic integration software developed by T. Ooura
2
1
0
2
4 6 8 10 12 Relative Tolerance (Error Bound for (A) and (B)) [10−x]
Fig. 5.
14
The execution time of Example2.
These numerical experiments show that the inclusions for the definite integrals by our algorithm can be obtained with almost the same computational time than that for obtaining approximate values of the integrals by a widespread approximation software developed by Ooura [10] provided that the 131
same relative tolerance is posed.
6. Conclusions A fast verified automatic integration algorithm is proposed for calculating univariate integrals over finite intervals. This algorithm is based on the double exponential formula. The double exponential formula uses a certain trapezoidal rule. This trapezoidal rule is determined by fixing two parameters, the width h of a subdivision of a finite interval and the number n of subdivision points of this subdivision. A theorem is presented for calculating h and n as a function of a given tolerance of the verified numerical integration of a definite integral. The proposed verified algorithm is designed for the discretization error and the truncation error to decrease at the almost same order in magnitude. An efficient a priori method is also proposed for evaluating function calculation errors including rounding errors of floating point calculations. Combining these, a fast algorithm is proposed for verified automatic integration. From the numerical results, we have confirmed in many cases that computational speed of the proposed algorithm are almost the same as that for the widely-used approximate integration software developed by Ooura.
Acknowledgments This research is supported by the Grant-in-Aid for Specially Promoted Research from the MEXT, Japan: “Establishment of Verified Numerical Computation”, (No. 17002012).
References [1] H. Takahasi and M. Mori, “Double exponential formulas for numerical integration,” Publ. RIMS, Kyoto Univ, vol. 9, pp. 721–741, 1974. [2] M. Sugihara, “Optimality of the double exponential formula,” Numerische Mathematik, vol. 75, pp. 379–395, 1997. [3] K. Tanaka, M. Sugihara, K. Murota, and M. Mori, “Function classes for double exponential integration formulas,” Numerische Mathematik, vol. 111, pp. 631–655, 2009. [4] Y. Kobata and N. Yamamoto, “Verified numerical integration using double exponential formula,” Master Thesis, The University of Electro-Communications, 2003. [5] T. Okayama, T. Matsuo, and M. Sugihara, “Error estimates with explicit constants for sinc approximation, sinc quadrature and sinc indefinite integration,” METR2009-01, The university of Tokyo, 2009. [6] M.C. Eiermann, “Automatic, guaranteed integration of analytic functions,” BIT, vol. 29, pp. 270–282, 1989. [7] K. Petras, “Self-validating integration and approximation of piecewise analytic functions,” J. Comput. Appl. Math., vol. 145, pp. 345–359, 2002. [8] Correctly Rounded mathematical library, http://lipforge.ens-lyon.fr/www/crlibm/. [9] R. Piessens et. al., QUADPACK: A Subroutine Package for Automatic Integration, Springer, 1983. [10] Ooura’s mathematical software packages, http://www.kurims.kyoto-u.ac.jp/ ooura/. [11] N. Yamanaka, T. Okayama, S. Oishi, and T. Ogita, “A fast verified automatic integration algorithm using double exponential formula,” RIMS Kokyuroku, no. 1638, pp. 146–158, 2009. [12] M. Kashiwagi, Private communication.
132