The N-Point Definite Integral Approximation Formula - Science

0 downloads 0 Views 410KB Size Report
Feb 21, 2017 - approximate solution to the definite integral. Since solutions ... solution. In calculus and engineering mathematics courses, we ...... [5] Gupta, C. B and Malik, A. K. (2009), Advanced Mathematics,. (New Age International Publishers) Pp 90-101. [6] Jain, M. K., S. R. K. Iyengar., and R. K. Jain, Numerical.
Applied and Computational Mathematics 2017; 6(1): 1-33 http://www.sciencepublishinggroup.com/j/acm doi: 10.11648/j.acm.20170601.11 ISSN: 2328-5605 (Print); ISSN: 2328-5613 (Online)

The N-Point Definite Integral Approximation Formula (N-POINT DIAF) Francis Oketch Ochieng’, Nicholas Muthama Mutua*, Nicholas Mwilu Mutothya Mathematics and Informatics Department, Taita Taveta University, Voi, Kenya

Email address: [email protected] (N. M. Mutua), [email protected] (F. O. Ochieng’), [email protected] (N. M. Mutua), [email protected] (N. M. Mutothya) *

Corresponding author

To cite this article: Francis Oketch Ochieng’, Nicholas Muthama Mutua, Nicholas Mwilu Mutothya. The N-Point Definite Integral Approximation Formula (NPOINT DIAF). Applied and Computational Mathematics. Vol. 6, No. 1, 2017, pp. 1-33. doi: 10.11648/j.acm.20170601.11 Received: November 20, 2016; Accepted: January 24, 2017; Published: February 21, 2017

Abstract: Various authors have discovered formulae for numerical integration approximation. However these formulae always result to some amount of error which may differ in size depending on the formula. It’s therefore important that a formula with highest precision has been discovered and should be implemented for use in numerical integration approximations problems, especially for the definite integrals which cannot be evaluated by applying the analytical techniques. The present paper therefore explores the derivation of the N-point Definite Integral Approximation Formula (N-point DIAF) which amounts to the discovery of the 2-Point DIAF. This formula will assist in almost accurate evaluation of all definite integrals numerically. The proof of the formula is given, a specific test problem is then solved using the discovered 2-Point DIAF to obtain the solution numerically, which has the highest precision compared to other numerical methods of integration. Further the error terms are obtained and compared with the existing methods. Finally, the effectiveness of the proposed formula is illustrated by means of a numerical example. Keywords: Numerical Integration, Approximation, Definite Integrals, Error, Analytical Techniques, Stability

1. Introduction Integrals of most analytical functions can be evaluated as

b I = ∫ f ( x)dx = F ( b ) − F ( a ) a

(1)

where F ( x) is differentiable function whose derivative is

f ( x) i.e. F / ( x ) = f ( x)

(2)

Often need arises for evaluating the definite integral of functions that does not have explicit antiderivative, in other circumstances the function is not known explicitly but is given empirically by a set of measured or tabulated values. In circumstances where the integral cannot be evaluated analytically, numerical integration is used to give approximate solution to the definite integral. Since solutions

obtained in numerical integration are approximate, there is usually error of approximation which is a measure of the deviation of the approximate solution from the exact value. Thus the best solution is that which converges to the exact solution. In calculus and engineering mathematics courses, we learnt many methods to solve the integral problems, including change of variables method, integration by parts method, partial fractions method, trigonometric substitution method, and so on [2]. In this paper, we present a formula to approximate definite integrals.

2. Objective b To approximate the definite integral ∫ w( x) f ( x)dx , where a the weight function, w( x) > 0 in a closed interval [a, b] using the newly developed N-point Definite Integral Approximation Formula (N-point DIAF) and discuss the

2

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

accuracy, convergence and stability of the method. Here, a and b are the limits of integration.

3. Literature Review [4] notes that Numerical integration is the study of how the numerical value of an integral can be found. Also called quadrature, which refers to finding a square whose area is the same as the area under a curve, it is one of the classical topics of numerical analysis. Of central interest is the process of approximating a definite integral from values of the integrand when exact mathematical integration is not available. Many methods are available for approximating the integral to the desired precision in Numerical integration. A new set of numerical integration formula of Open Newton-Cotes Quadrature with Midpoint Derivative type is suggested, which is the modified form of Open Newton-Cotes Quadrature [9]. Numerical integration is the process of computing the value of a definite integral from a set of numerical values of the integrand. The process of evaluation of integration of a function of a single variable is sometimes called Mechanical Quadrature. The computation of a double integral of a function of two independent variables is called Mechanical Cubature. There are many methods are available for numerical integration [8]. Integral Calculus is a fundamental field of study in Mathematics and is widely used to model physical processes by scientists and engineers [3]. It has widespread uses in science, engineering and economics and can solve many problems that Algebra alone cannot [1]. Most of the models are always definite integrals which need to be evaluated in order to get a solution that provide a basis for drawing a conclusion. Most of the integrals are easy to evaluate using analytical methods. However, some integrals cannot be evaluated analytically and therefore need to be approximated. This means that we have to apply numerical methods in order to get an approximate solution. This is referred to as numerical integration. Several authors have discovered formulae for approximating such integrals which can only be evaluated numerically. [5] reiterate that some of the great mathematicians and scientists such as Romberg, Simpson, Gauss-Legendre, Gauss-Chebyshev, Newton-Cotes, for instance, have made remarkable contribution in this area. Sir Isaac Newton made use of forward difference operator and forward difference table to simplify the calculations involved in the polynomial approximation of functions which are known at equally spaced data points. Thus, the Newton Forward Difference Interpolating Polynomial (NFDIP) of degree 4 provides a basic foundation upon which the N-point DIAF is based [6]. It is worthwhile to note further that the choice of the variables used in the N-point DIAF, stated in the next section below, does not in any way suggest any correlation with the neighborhood method used in Regression Analysis (i.e. the k-Nearest Neighbours Regression algorithm).

3.1. Statement of the Formula Suppose f ( x ) is a function of the equally spaced argument x, which may be given explicitly or as a tabulated data. Then we evaluate definite integral in closed interval [a, b b b] as I = ∫ f ( x)dx we can define the integral ∫ w ( x ) f ( x )dx a a b−a where w ( x ) is the weight function. Let h = , where h is 4N the length the interval  xi , x  and N is the number of i +1   sub-intervals and w ( x ) = 1 then the N-point DIAF for

b ∫ w( x) f ( x)dx is given by: a b 2h 4 N ∑ λ f (a + kh) ∫ w( x) f ( x)dx = 45 k =0 k a

(3)

where the weights are given by

7, if ( k = {0, 4 N } )

λk = 

(4)

 y, otherwise

where     2k + (−2)k   − k 1 N = 1, 2,3,... , y = 32 + ( −1)     r 2k −1  r  2k + 1 −     2 5  2 9  

(

)

     (5)        

and r = k mod4 (that is r is the remainder when k is divided by 4). It is important to note that the proof of this formula is explored in the next section below, and it explains the genesis behind it in detail. 3.2. Formula Proof

b−a and w( x) = 1 , then to approximate the 4N b definite integral ∫ w( x) f ( x)dx : a We subdivide the interval [a, b] into 4N subdivisions of Let h =

equal width h and then fit a polynomial of degree 4 on [ x0 , x4 ],[ x4 , x8 ],[ x8 , x12 ],...,[ x4 N − 4 , x4 N ] . Here,

,x are suitable points in the x , x , x , x ,..., x 0 1 2 3 4 N −1 4 N interval of integration. Using the NFDIP (Newton Forward Difference Interpolating Polynomial), we approximate

Applied and Computational Mathematics 2017; 6(1): 1-33

s ( s − 1) 2 s( s − 1)( s − 2) 3 ∆ f + ∆ f 0 0 2! 3! ; s( s − 1)( s − 2)( s − 3) 4 + ∆ f 0 + RN 4! x−a where RN is the error term, s = , and ∆ is the forward h difference operator (i.e. ∆f = f − f , by definition). k k +1 k f ( x) = f0 + s∆f0 +

3

Neglecting the error term, RN , as it is too small hence b negligible, we then approximate ∫ w( x) f ( x)dx in each 4 a subdivisions and then summing them up as follows:

b ∫ f ( x) dx ≈ I1 + I 2 + I3 + ... + I N ≈ I1 + I 2 + I3 + ... + I N a x x x 8 4 12 ≈ ∫ f ( x)dx + ∫ f ( x)dx + ∫ f ( x)dx + ... x x x 0 4 8 x 4N + ∫ f ( x) dx x 4 N −4

x 4 ⇒ I1 = ∫ x 0

s( s − 1) 2    f0 + s∆f0 + 2! ∆ f0 +    4  s( s − 1)( s − 2) 3 x−a 1  ds ∆ f0 f ( x)dx ≈ h ∫   , (since, s = h ⇒ ds = h dx , x0 = a ) 3! 0   + s ( s − 1)( s − 2)( s − 3) ∆ 4 f   0  4!   (s 2 − s) 2 ( s3 − 3s 2 + 2s ) 3  ∆ f0 + ∆ f0  4  f0 + s ∆f 0 + 2 6  ds ⇒ I1 ≈ h ∫   4 3 2 0  ( s − 6s + 11s − 6 s ) 4  ∆ f0 + 24  

   s3 s 2   s4   4    − − s3 + s 2   3  4  2    s2     2 3 ∆f + ∆ f + ∆ f   sf0 + 0 0 2 0 2 6  ⇒ I ≈ h 1   5   s 3 11    − s 4 + s 3 − 3s 2     5 2  3  ∆4 f +  0 0 24  

20 8 14   ⇒ I ≈ h  4 f + 8∆f + ∆ 2 f + ∆3 f + ∆ 4 f  1 0 0 0 0 0 3 3 45  20 8    4 f0 + 8( f1 − f0 ) + 3 ( f 2 − 2 f1 + f 0 ) + 3 ( f3 − 3 f 2 + 3 f1 − f 0 )  ⇒ I ≈ h  1  + 14 ( f − 4 f + 6 f − 4 f + f )  3 2 1 0  45 4 

64 24 64 14  14  ⇒ I ≈ h f + f + f + f + f ) 1 0 1 2 3 4 45 45 45 45 45  

2h  ⇒I ≈ 7 f + 32 f + 12 f + 32 f + 7 f )  1 45  0 1 2 3 4  Similarly,

2h  I ≈ 7 f + 32 f5 + 12 f + 32 f7 + 7 f ) 2 45  4 6 8 

2h  I ≈ 7 f + 32 f + 12 f + 32 f + 7 f )  3 45  8 9 10 11 12 

,

...

,

4

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

2h 7 f 4 N −4 + 32 f4 N −3 + 12 f 4 N −2    45  +32 f4 N −1 + 7 f 4 N )   Thus,

IN ≈

 7( f + f ) + 12( f + f + f + ... + f ) 0 4N 2 6 10 4 N −2  b 2h   +32( f + f + f + f + ... + f +f )  ∫ f ( x ) dx ≈ 7 1 3 5 4 N −3 4 N −1  45  a  +14( f 4 + f8 + ... + f 4 N − 4 )   

b 2h 4 N ⇒ ∫ w( x) f ( x)dx = ∑ λ f , but 45 k =0 k k a x = ( xo + kh) = (a + kh) . Therefore, k

f = f ( x ) and k k

b 2h 4 N ⇒ ∫ w( x) f ( x) dx = ∑ λ f (a + kh) 45 k =0 k a

k = 1(1)4 N − 1 ], to yield the same values of λ 's ’s as in (8) k above. This means that we can compile a table for the values a  of k against  k  for equation (9) as shown in Table 1 below b   k 

(7)

which conforms to the statement of the N-point DIAF so long as we can find the values for the weights, λ 's ’s. k Now, from equation (6) it can be clearly seen that the

a Table 1. Values of k against  k b  k

k

weights λ = 7 whenever k = 0 , k = 4N ; Or λ = y k k k N 1 ≤ ≤ 4 − 1 k whenever ; y is dependent on , i.e.

a  k b  k

1

21 + ( −2)1 =0 1

7, if ( k = {0, 4 N } ) λk =  , where the values of the multiplier,  y, if 1 ≤ k ≤ 4 N − 1

2

y , oscillate back and forth between 12 ← → 32 ← → 14

3

starting counting from k = 1 at 32 then Left-Right manner in steps of 1 respectively until the last count reaches k = 4N −1 . [Here, k = 1(1)4 N − 1 ]. This means that   λ4 = 14,..., λ4 N − 4 = 14, λ4 N −3 = 32,   λ4 N − 2 = 12, λ4 N −1 = 32 

λ0 = 7, λ1 = 32, λ2 = 12, λ3 = 32,

(8) 6

Our main task is to find the expression for y as follows. If we subtract each λ value from 32 [i.e. (32 − λ ) ], then k k it follows that



 (9a)

b   k 

where ak and bk depend on k . a  The values of  k  now oscillate back and forth between b   k  → 0 ← → 18 20 ← [i.e,

→(32 − 32) ← → (32 − 14) (32 − 12) ←

4

5

a λk = y = 32 + (−1)k  k 

]

(6)

7

8 . . . 4N − 4

   

22 + (−2)2 = 20 21 5 23 + (−2)3 =0 1 24 + ( −2)4 = 18 24 9 25 + (−2)5 =0 1 26 + (−2)6 = 20 25 5 27 + (−2)7 =0 1 28 + (−2)8 = 18 28 9 . . . 24 N −4 + (−2)4 N −4 = 18 2 4 N −4 9

4N − 3

4N − 2

starting

counting from k = 1 at 0 then Left-Right manner in steps of 1 respectively until the last count reaches k = 4N −1 [Here,

  for equation (9a).  

24 N −3 + ( −2) 4 N −3 =0 1 24 N −2 + (−2)4 N −2 = 20 24 N −3 5

4N −1

2 4 N −1 + ( −2) 4 N −1 =0 1

Applied and Computational Mathematics 2017; 6(1): 1-33

0 = 0m + c 1 1

From the Table 1.0 above, it’s evident that

a = 2k + (−2)k k

(9b)

and the values of b form the sequence: k  21 24 25 28 ,1, ,1, ,1, ,...,1,  5 9 5 9   k  2k −1  2 p  +,...., +1  +q   5 9    

[0,1] → [2, 0] . If we let this relationship to be

q = m r+c 2 2

(12)

(13)

where m1 and c1 are constants to be evaluated for relationship (12) to hold. Plugging the values of (12) into (13) yields

and

(17)

2 = 0m + c 2 2

(17a)

0 = 1m + c 2 2

(17b)

and

Solving (17 a ) and (17b) simultaneously yields (17) Substituting equations (14) and (17) into equation (11) and neglecting all the values for b = 1 , as they are insignificant k in the final result for y , yields

bk =

r 2 k −1  r  2 k + 1 −  2 5  2 9

(18)

Substituting equation (11) and (18) into equation (9) yields

    2k + (−2)k  k −1   y = 32 + ( −1)    r 2k −1  r  2k + 1 −     2 5  2 9  

(

)

as required.

(14)

3.3. Numerical Illustration

(14a)

Approximate the integral 1 1 dx ; using ∫ 0 x +1

This is because,

2 = 1m + c 1 1

 r q = 1 −   2 This is because,

If we let this relationship to be

r p= 2

(16)

where m and c are constants to be evaluated for 2 2 relationship (15) to hold. Plugging the values of (10) into (11) yields

(11)

where p and q are dependent on k and are to be evaluated as follows If we now let r = k mod4 (i.e. r is the remainder when k is divided by 4), then it follows that when r = 2 ⇒ p = 1 and 2k −1 q = 0 , so that b = , which satisfy the sequence (11) k 5 above. 2k Also when r = 0 ⇒ p = 0 and q = 1 so that b = , k 9 which also satisfy the sequence (11) above. Thus, there is a linear relationship between r and p which transforms the discrete extreme points [1, 0] in p onto [2,0] in r , i.e

p = m r+c 1 1

(15)

(10)

p and q take values 0 and 1 alternating [i.e. when p = 0 , q = 1 and when p = 1 , q = 0 ]. Thus the k th term, b , is given by k

[1, 0] → [2, 0] .

(14b)

Solving (14a) and (14b) simultaneously yields (14). Similarly, there is a linear relationship between r and q which transforms the discrete extreme points [1, 0] in q onto [2,0] in r , i.e.

1,

 2k −1 2k p +q , if ( k mod 2 = 0) b = 5 9 k 1, otherwise 

5

1) Gauss-Chebyshev 3 point formula. 2) Gauss-Legendre 3 point formula. 3) Simpson’s 3/8 rule with 8 subdivisions.

            

(19)

6

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

f (t )

4) Trapezoida rule with 1, 2, 4, and 8 subdivisions. Hence, use Romberg approximation to obtain a most accurate solution. 5) Using Boole’s rule with n = 4, 8 6) Using weddles ’s rule with n = 6 7) The 2-point DIAF. Hence calculate the absolute relative true error, ∈t ,

1− t2

exact

solution

of

1 1 dx ∫ 0 x +1

analytically

1 3+t

. 1− t2 ⇒ f (t ) = 3+ t Thus,  2  3  1 −    π   2  ⇒I=  3     3 +  3      2   = 0.729864959

involved in each approximation. Solution The

=

is

1

[ ln( x + 1)] 0 = ln(2) − ln(1) = 0.69314718

    2  +  1− 0   3+0     

 2   3 1 − −      2  +    3   3+−     2   

         

Using Gauss-Chebyshev 3 point formula

1 1 I=∫ dx 0 x +1

∈t =

(20)

≈ ( 5.297256 ) %

We first transform the interval [0,1] onto [−1,1] using the

Using Gauss-Legendre 3 point formula

b−a  b+a  transformation x =  where a = 0 and t +    2   2  , 1 1 b =1 ⇒ x = t + , 2 2

⇒ dx =

1  dt  2 

(21)

1 1 I=∫ dx 0 x +1 b−a  b+a  transformation x =  t +   where a = 0 and  2   2 , 1 2

b =1 ⇒ x = t +

1 1 I= ∫ dt . −1 3 + t 3

point formula  3  f − , here  2   

1 1 Then by Gauss-Legendre 3 point formula I = ∫ f (t )dt = 5 f 9  −1

1  1 ⇒ dx = dt  , 2  2

 3  −  + 8 f ( 0 ) + 5 f  5

(

)

h=

(23)

1 1 dt . Substituting equation (ii ) * into (i ) * yields, I = ∫ −1 3 + t

 3  1 .   , here f ( t ) = 3+t  5  

     0.69314718 − 0.693121693 ∈t = ×100%      1   1   1   1  0.69314718 + 8  + 5 = 0.693121693 Thus, ⇒ I = 5 9  3   3  3  ≈ 3.6771×10−3 %   3−   3+  5 5     0.69314718 − 0.693121693 × 100% ≈ 3.6771× 10−3 % 0.69314718 Using Simpson’s 3/8 rule with 8 subdivisions

(

(22)

We first transform the interval [0,1] onto [−1,1] using the

Substituting equation (ii ) * into (i ) * yields,

Then by Gauss-Chebyshev 1 π   3 I = ∫ f (t )dt =  f   + f ( 0) + 3   2  −1

0.69314718 − 0.729864959 × 100% 0.69314718

1− 0 1 1 = ; f ( x) = ; x +1 8 8

)

Applied and Computational Mathematics 2017; 6(1): 1-33

Table 2. Values of

x

0

f ( x)

1

1 8 8 9

1 4 4 5

3 8 8 11

7

x against f ( x ) = 1 . x +1

5 8 8 13

1 2 2 3

3 4 4 7

7 8 8 15

1

1 2

Then by Sympson’s 3/8 rule.

b 3h  f0 + 3( f1 + f2 + f 4 + f5 + f 7 + f8 + − − − + f3N −2   ∫ f ( x)dx =  8  + f3N −1 ) + 2( f3 + f6 + f9 + − − − + f3N −3 ) + f3N  a   Thus for 8 subdivisions we have,

1 1 3h  f 0 + 3( f1 + f 2 + f 4 + f5 + f7 )    I=∫ dx =  8  +2( f3 + f6 ) + f8 0 x +1   8 4 2 8 8   1 3   1 + 3  + + + +  +  8  9 5 3 13 15   ⇒ I =   = 0.684854208  8   8 4 1  2  +  +    11 7  2  0.69314718 − 0.684854208 × 100% 0.69314718 ≈ 1.196423%

∈t =

Using Romberg Approximation

h=

1− 0 1 1 = ; f ( x) = ; x +1 8 8

Table 3. Values of

x

0

f ( x)

1

1 8 8 9

1 4 4 5

3 8 8 11

x against f ( x ) = 1 . x +1

5 8 8 13

1 2 2 3

Using trapezoidal rule with 1 subdivision.

h=

1− 0 =1 1

(

1 1 1 T =∫ dx = ( h) f + f 1 0 8 2 0 x +1 1  1 ⇒ T = (1)  1 +  = 0.75 1 2  2 Using trapezoidal rule with 2 subdivisions.

h=

1− 0 1 = 2 2

)

3 4 4 7

7 8 8 15

1

1 2

8

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

(

)

1 1 1 T =∫ dx = (h) f + 2 f + f 2 0 4 8 1 2 x + 0 1 1   2 1 ⇒ T = ( ) 1 + 2   +  = 0.708333333 2 2 2  3 2  Using trapezoidal rule with 4 subdivisions.

h=

1− 0 1 = 4 4

(

(

)

)

1 1 1 T =∫ dx = (h) f + 2 f + f + f + f 4 0 2 4 6 8 2 0 x +1 1 1  4 2 4 1 ⇒ T = ( ) 1 + 2  + +  +  = 0.697023809 4 2 4 5 3 7 2  Using trapezoidal rule with 8 subdivisions.

h=

1− 0 1 = 8 8

   f1 + f 2 + f3 + f 4 + f5 +  1 1 1 + f  T =∫ dx = (h)  f + 2  8  8 f +f  0 2 0 x +1 7  6    1 1  8 4 8 2 8 4 8  1 ⇒ T = ( ) 1 + 2  + + + + + +  +  8 2 8  9 5 11 3 13 7 15  2  

= 0.69412185 Now, using Romberg approximation, we apply the iterative formula below to obtain the Romberg extrapolates as shown below T2 N ,i +1 =

− TN ,i 4T 2 N ,i 3

Table 4. Romberg Integration Iterative Formula. N 1

TN 0.75

2

0.708333333

T2N,1

T2N,2

T2N,3

0.694444444 0.692857142 0.693253967 4

0.697023809

8

0.69412185

0.693209465 0.693121384

0.69315453

∈t =

0.69314718 − 0.693209465

(

0.69314718

≈ 8.985847 × 10

−3

× 100%

)%

Using Boole’s rule with n = 4 h=

I=

1

4

= 0 .25

2h ( 7 y0 + 32 y1 + 12 y2 + 32 y3 + 7 y4 ) 45

Applied and Computational Mathematics 2017; 6(1): 1-33

I=

2 × (0 .25 ) ( 7 × 1 + 32 × 0.8 + 12 × 0 .66667 + 32 × 0.571429 + 7 × 0.5 ) 45

I = 0 .693175 ∈t =

0.69314718 − 0.693175

× 100%

0.69314718

≈ (4.013578 × 10

−3

)%

Using Boole’s rule with n = 8 h=

I= I=

1

8

= 0 .125

2h [7 y0 + 32( y1 + y3 + y5 + y7 ) + 12( y2 + y6 ) + 14 y4 + 7 y8 ] 45

2 × (0 .125 ) [( 7 × 1) + 32(0 .88889 + 0 .727273 + 0 .615385 + 0 .53333 ) + 12 (0 .8 + 0 .57142 9 ) + (14 × 0 .66667 ) + (7 × 0 .5 )] 45

I = 0 .693148 ∈t =

0.69314718 − 0.693148 0.69314718

≈ (1.04088 × 10

−4

× 100%

)%

Using weddles ’s rule with n = 6 h =

I=

I=

1

= 0 .16667

6

3h [ y0 + 5 y1 + y2 + 6 y3 + y4 + 5 y5 + y6 ] 10

3 × 0.1667 [1 + 5 × 0.857143 + 0.75 + 6 × 0.66667 + 0.6 + 5 × 0.545454 + 0.5 ] 10

I = 0 .693149114 ∈t =

0.69314718 − 0.693149114 0.69314718

≈ (2.79072 × 10

−4

× 100%

)%

Using the 2-point DIAF N=2; h =

1 2  1 1 k 8 8 So that, I=∫ dx =   ∑ λ f ( ) k 1 45 8 x + K =0 0

1− 0 4(2)

=

1 8

; f ( x) =

(

1

x +1

; w( x) = 1

7, if k = {0,8} Then for the 2-point DIAF, the weights are given by λ =  k  y, otherwise

)

9

10

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

    2k + (−2)k  k −1   where y = 32 + ( −1)    r 2k −1  r  2k + 1 −     2 5  2 9   

)

(

            

and r = k mod4 λ =7 0

         1 1 2 + (−2)    2 2  1−1   2 + (−2)  2 − 1   λ1 =  32 + ( − 1)   1−1 1    λ =  32 + ( − 1)   1 2 1 2 2     2 − 1 2    + 1−   2  2          2 2 + 1 −  2 5   2 9         2 5     2  9     ,        3   2 0    = 12 = 32 −  = 32 +  = 32  0 2 2   1    5  2  5       

(

)

(

     3 −1  λ =  3 2 + ( − 1)  3      

  2 + (−2)  3    3 2 3 −1  3  2   + 1−     2 9      2 5     0  = 32 = 32 +  3   3 2 3 −1  32 + 1−    2 5 2 9   

     4 −1  λ 4 =  3 2 + ( − 1)       

   = 32 −    

2

5

 24     9 

(

3

3

(2

4

4

+ (−2)

)

)

4  0 2 4 − 1  0  2   + 1−    2 5 2 9    

    = 14   

Similarly, it follows that on substitution: λ 5 = 32, λ

Thus,

6

= 12, λ 7 = 32, λ

8

=7

      

)

Applied and Computational Mathematics 2017; 6(1): 1-33

11

          1   1   1   7  0  + 32  1  + 12  2     + 1  + 1  + 1  8  8    8   1        2         1 1 1  8   +32 ⇒I =   3  + 14  4  + 32  5  45   + 1  + 1  + 1 8   8   8                 +12  1  + 32  1  + 7  1   7 8  6   + 1   + 1  +1  8   8     8  = 0.693147901

∈t =

0.69314718 − 0.693147901

(

0.69314718

≈ 1.0394 × 10

−4

× 100%

)%

2

∫x

x + 1dx

1

The exact solution of 2

I = ∫ x x + 1dx

(24)

1

analytically is as follows Using integration by parts, put  dv = x + 1dx u=x  3  ⇒ du = dx ⇒ v = 2 ( x + 1) 2  3 

(25)

Then by integration by parts, it follows that 2 2 3  3  2 − ∫ 2 3 ( x + 1) 2 dx 1 1 2  3 5  ⇒ I =  2 x(x + 1) 2 − 4 ( x + 1) 2  3 15  1 I = 2 x(x + 1) 3

= 2.771281292 − 0.3771236166

⇒ I = 2.394157675

Using Gauss-Chebyshev 3 point formula 2

I = ∫ x x + 1dx

(26)

1

b−a  b+a  We first transform the interval [1, 2] onto [−1,1] using the transformation x =  t +   where a = 1  2   2 , and b = 2 ⇒ x = 1 ( t + 3) , 2

⇒ dx = 1 dt 2

(27)

12

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

1

Substituting equation (ii ) * into (i ) * yields, I =



4

−1

Then f (t ) 1− t2

by

= 1

⇒ f (t ) = 1

Thus,

Gauss-Chebyshev

4 2

( t + 3)( t + 5)

4 2

( t + 3) ( t + 5) (1 − t

1

3

( t + 3)( t + 5) 2 dt . 2 1

1

point

formula

1 π I = ∫ f (t )dt =  f 3  −1

 3   + f ( 0 ) +  2 

 3  f −  2    

,

here

2

. 2

)

  2    3   3    3       + 3 + 5 1 −  2    2   2               π   1 − 0 2  ⇒I= . 1 + ( 0 + 3 ) ( 0 + 5 )    3 4 2    2             3 3  3  +   −            2  + 3    − 2  + 5 1 −  − 2                  π 4.681733381+ 6.708203932 =   12 2 + 2.16941756  = 2.510109434

2.394157675 − 2.510109434 × 100 o o 2.394157675 ≈ 4.843112898 o o

εt =

Using Gauss-Legendre 3 point formula 2

I = ∫ x x + 1dx

(28)

1

We first transform the interval [1, 2] onto [−1,1]

b−a  b+a  using the transformation x =  t +    2   2 , where a = 1 and b = 2 ⇒ x = 1 ( t + 3) , 2

⇒ dx = 1 dt 2 1

Substituting equation (ii ) * into (i ) * yields, I =



−1

Then f (t ) = 1

by

4

Gauss-Legendre

( t + 3)( t + 5 ) 2

1

2

3

point

( t + 3)( t + 5) 2 dt . 2 1

1 4

formula

1 1 I = ∫ f (t )dt = 5 f 9  −1

.

Thus, 1    2    3    3  5  − 5  + 3   − 5  + 5             1 1 1 ⇒I= .  + 8(0 + 3)(0 + 5) 2  9 4 2  1      2  + 5 3 + 3  3 + 5    5    5      1 22.87245718 + 53.66563146  =   36 2 + 45.35251595  = 2.394157585

(29)

 3  −  + 8 f ( 0 ) + 5 f  5

 3      5  

,

here

Applied and Computational Mathematics 2017; 6(1): 1-33

εt =

13

2.394157675 − 2.394157585 × 100 o o 2.394157675

≈ 3.74926 × 10 −6 o o Using Simpson’s 3/8 rule with 8 subdivisions

h=

2 −1 1 = ; f ( x) = x x + 1 8 8

Table 5. Values of x

1

f ( x)

2

3 2

2.371708245

x against f ( x ) = x x + 1 .

9 8

5 4

11 8

1.63995522

1.875

2.119017314

13 8

7 4

15 8

2

2.632800909

2.902046692

3.17921718

2 3

Then by Sympson’s 3/8 rule.

b 3h  f0 + 3( f1 + f2 + f 4 + f5 + f 7 + f8 + − − − + f3N −2   ∫ f ( x)dx =  8  + f3N −1 ) + 2( f3 + f6 + f9 + − − − + f3N −3 ) + f3N  a   Thus for 8 subdivisions we have,

  f1 + f 2 + f 4    3h  f 0 + 3  I = ∫ x x + 1dx =   + f5 + f7   8  1   +2 ( f 3 + f 6 ) + f8  2

  1.63995522 + 1.875       3  2 + 3  +2.371708245 + 2.902046692  +  I = ∫ x x + 1dx =  +3.17921718   64     1  2 ( 2.119017314 + 2.632800909 ) + 2 3    I = 2.357143764 2

2.394157675 − 2.357143764 × 100 o o 2.394157675 ≈ 1.546009746 o o

εt =

Using Romberg Approximation

h= Table 6. Values of x

f ( x) 3 2 2.371708245

1

2

2 −1 1 = ; f ( x) = x x + 1 8 8

x against f ( x ) = x x + 1 for Romberg Integration.

9 8

5 4

11 8

2

1.63995522

1.875

2.119017314

2 3

13 8 2.632800909

7 4 2.902046692

15 8 3.17921718

14

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

Using trapezoidal rule with 1 subdivision.

h= 2

2 −1 =1 1

T1 = ∫ x x + 1dx = 1

1 h ( f 0 + f8 ) 2

(

1 .1 2 + 2 3 2 = 2.439157589

⇒ T1 =

)

Using trapezoidal rule with 2 subdivisions.

h= 2

T2 = ∫ x x + 1dx = 1

( )(

1 1 2 2 = 2.405432917

⇒ T2 =

2 −1 1 = 2 2

1 h ( f 0 + 2 f 4 + f8 ) 2

2 + 2 ( 2.371708245 ) + 2 3

)

Using trapezoidal rule with 4 subdivisions.

h= 2

T4 = ∫ x x + 1dx = 1

2 −1 1 = 4 4

1 h ( f 0 + 2 ( f 2 + f 4 + f 6 ) + f8 ) 2

 1.875 + 2.371708245  1 1   2 + 2   + 2. 3  4 2  +2.902046692    = 2.396978131

⇒ T4 =

( )

Using trapezoidal rule with 8 subdivisions.

h=

2 −1 1 = 8 8

   f1 + f 2 + f3   1    T8 = ∫ x x + 1dx = h  f 0 + 2  + f 4 + f5 + f 6  + f8  2  1 + f    7      1.63995522 + 1.875 +      2.119017314 2.371708245 + 1 1  +2 3 ⇒ T8 = 2 + 2   +2.632800909 + 2.902046692  2 8         +3.17921718    = 2.394862894 2

( )

Now, using Romberg approximation, we apply the iterative formula below to obtain the Romberg extrapolates as shown below T2 N ,i +1 =

4T − TN ,i 2 N ,i 3

Applied and Computational Mathematics 2017; 6(1): 1-33

Table 7. Values of N 1

TN 2.439157589

2

2.405432917

15

x against f ( x ) = x x + 1 for Romberg Iterative Integration.

T2N,1

T2N,2

T2N,3

2.39419136 2.394149372 2.394159869 4

2.396978131

8

2.394862894

2.394159716 2.39415713

2.394157815

2

So the Romberg approximation gives I = ∫ x x + 1dx = 2.394159716 1

εt =

2.394157675 − 2.394159716 × 100 o o 2.394157675

≈ 8.5249 × 10 −4 o o Using Boole’s rule with n = 4 h=

I= I=

1

4

= 0 .25

2h ( 7 y0 + 32 y1 + 12 y2 + 32 y3 + 7 y4 ) 45

2 × (0 .25 ) ( 7 × 1 .414214 + 32 × 1 .875 + 12 × 2 .371708 + 32 × 2 .902047 + 7 × 3 .464102 ) 45

I = 2 .394158

εt =

2.394157675 − 2.39415777 × 100 o o 2.394157675

≈ 3.97451 × 10−6 o o Using Boole’s rule with n = 8 h=

I= I=

1

8

= 0 .125

2h [7 y0 + 32( y1 + y3 + y5 + y7 ) + 12( y2 + y6 ) + 14 y4 + 7 y8 ] 45

+ 2119017 + 2632801 + 3179217 . ) + 321639955 (. . . . ) 2×(0125 . ) 7×1414214   ( . + 2902047 . ) + (14×2371708 . ) + (7×3464102 . ) 45  +121875 

I = 2 .394158

εt =

2.394157675 − 2.394158 × 100 o o 2.394157675

≈ 3.97451 × 10−6 o o Using weddles ’s rule with n = 6

16

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

h=

I= I=

1

6

= 0 .16667

3h [ y0 + 5 y1 + y2 + 6 y3 + y4 + 5 y5 + y6 ] 10

3×0.1667 1.414214 + 5×1.717349 + 2.036766 + 6×2.371778 +2.721729 + 5×3.086037 + 3.464182  I = 2 .394703395 10  

εt =

2.394157675 − 2.394703395 × 100 o o 2.394157675

≈ 2.2793832 × 10−2 o o Using the 2-point DIAF 2 −1 1 = ; f ( x ) = x x + 1 ; w( x) = 1 N=2; h = 4(2) 8 2



So that, I = x x + 1dx = 1

( )

2 1 8 45

8

∑λ k =0

k

 k f 1 +   8 7, if ( k = {0,8} )

Then for the 2-point DIAF, the weights are given by λk = 

 y, otherwise

    2k + (−2)k  k −1   y = 32 + ( −1)    r 2k −1  r  2k + 1 −     2 5  2 9   and r = k mod4

)

(

where

             λ =7 0

      1 1    2 + (−2)  1−1      2 2 λ1 =  32 + ( − 1) 2 + (−2)   1−1 1    2 − 1    1  2    λ =  32 + ( − 1)    1 2  + 1−  2 2 −1 2     2 5   2  2    2  9       2 2 + 1 −      2 5   2  9             0   3   2 = 32 +  = 32  = 12 = 32 −   0   12    2  2 5  5      ,

(

)

(

)

Applied and Computational Mathematics 2017; 6(1): 1-33

     3 −1  λ 3 =  3 2 + ( − 1)       

17

  2 + (−2)   3 1 3 −  3 2 32     + 1 −      2 9      2 5

(

3

3

  0 = 32 +  3 1 3 − 3 2 32  + 1−   2 9  2 5

   = 32   

     4 −1  λ 4 =  3 2 + ( − 1)       

(

2

4

4 −1

 0 2   2 5

+ (−2) +

4

)

)

4  0  2    1−  2 9   

      

     25  = 32 −  = 14  24       9    

Similarly, it follows that on substitution:

λ5 = 32, λ = 12, λ7 = 32, λ = 7 6 8 Thus,

(

)

7 1 1 + 1 + 32 9 9 + 1    8 8            + 12 5 5 + 1  + 3211 11 + 1   4 4 8 8       2 1  8    3 3 13 13 + 1   ⇒I= + 14 2 2 + 1  + 32 8 8     45       7 7 15 15 +1 + 12 4 4 + 1  + 32 8 8    + 7 2 2 + 1   

( )

(

)

( )

 7 2 + 32(1.63995522) + 12(1.875)    1  + 32(2.119017314) + 14(2.371708245) ⇒I=   180  + 32(2.632800909) + 12(2.902046692)  + 32(3.17921718) + 7 2 3    = 2.394157677

( )

εt =

2.394157675 − 2.394157677 × 100 o o 2.394157675

≈ 8.3537 × 10 −8 o o 1

∫ xe

x2

dx

0

The exact solution of 1

I = ∫ xe x dx − − − − − − − − (i ) 2

0

(30)

18

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

analytically is as follows Put

 u = x2  − − − − − − − − − − (ii ) ⇒ du = 2 xdx 

(31)

Then substituting (ii) into (i) yields 1

I = ∫ 1 e u du 2 0

[ ]

1 ⇒ I = 1 e u 0 = 1 (e − 1) 2 2 ⇒ I = 0.8591409142

Using Gauss-Chebyshev 3 point formula 1

I = ∫ xe x dx 2

(32)

0

b−a  b+a  We first transform the interval [0,1] onto [−1,1] using the transformation x =  t +   where a = 0  2   2 , and b = 1 ⇒ x = 1 t + 1 2 2,

⇒ dx = 1 dt 2 1

1

Substituting equation (ii ) * into (i ) * yields, I =



−1

1

4(

t + 1) .e

4(

(33) t +1)

2

dt .

1 π   3 Then by Gauss-Chebyshev 3 point formula I = ∫ f (t )dt =  f   + f ( 0) + 3   2  −1 1 ( t +1)2 f (t ) = 1 ( t + 1) .e 4 4 2 here 1 − t . 1 ( t +1)2 2 ⇒ f (t ) = 1 ( t + 1) .e 4 1− t 4 2       1  3 +1  2     3   3  4  2   + 1.e   1 −  2   2            2   1 ( ) 0 + 1 π 1 − 0 2   ⇒ I = . 1 + (0 + 1).e 4 4   3     Thus, 2  3    1  − +1  2        3  4  2 3   +  − + 1.e 1 −  − 2      2          π = (2.228160234 + 1.284025417 + 0.06728856552 ) 12 = 0.9371041584

(

 3  f −  ,   2  

)

0.8591409142 − 0.9371041584 × 100 o o 0.8591409142 ≈ 9.07455842 o o

εt =

Using Gauss-Legendre 3 point formula

Applied and Computational Mathematics 2017; 6(1): 1-33

19

1

I = ∫ xe x dx 2

(34)

0

We first transform the interval [0,1] onto [−1,1]

b−a  b+a  using the transformation x =  t +   where a = 0  2   2 , and b = 1 ⇒ x = 1 t + 1 2 2,

⇒ dx = 1 dt 2 1

1

Substituting equation (ii ) * into (i ) * yields, I =



1

−1

4(

t + 1) .e

4(

1 1 Then by Gauss-Legendre 3 point formula I = ∫ f (t )dt = 5 f 9  −1 Thus,

t +1)

2

dt .

 3  −  + 8 f ( 0 ) + 5 f  5

   1  − 3 +1 5  − 3 + 1 .e 4  5     5    1 ( 0 +1)2 1  ⇒ I = . 1  +8 ( 0 + 1) .e 4 9 4 2   3   1 4  5 +1   3 + 1 .e  +5      5 1 1.14142294 + 10.27220333 =   36  +19.49795163  = 0.8586549417

εt =

(35)

2

 3  1 ( t +1)2 .   , here f (t ) = 1 4 ( t + 1) .e 4  5  

         

0.8591409142 − 0.8586549417 ×100 o o 0.8591409142

≈ 5.6564938 × 10−1 o o Using Simpson’s 3/8 rule with 8 subdivisions

h= Table 8. Values of

x against

2 1− 0 1 = ; f ( x) = xe x 8 8

f ( x ) = xe x for Simpson’s 3/8 rule with 8 subdivisions. 2

x

0

1 8

1 4

3 8

f ( x)

0

0.1269684636

0.2661236147

0.4316223543

1 2 0.6420127083

5 8 0.9236901221

1 2.718281828

Then by Sympson’s 3/8 rule.

b 3h  f0 + 3( f1 + f2 + f 4 + f5 + f 7 + f8 + − − − + f3N −2   ∫ f ( x)dx =  8  + f3N −1 ) + 2( f3 + f6 + f9 + − − − + f3N −3 ) + f3N  a  

20

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

Thus for 8 subdivisions we have,

  f1 + f 2 + f 4    3h  f 0 + 3  I = ∫ xe dx =   + f5 + f7   8  0   +2 ( f3 + f 6 ) + f8  1

x2

   0.1269684636 + 0.2661236147      0 3 0.6420127083 + + + 3     x2 I = ∫ xe dx =     0.9236901221 1.881545676 + 64   0      +2 ( 0.4316223543 + 1.316290993) + 2.718281828  1

I = 0.8313342317 0.8591409142 − 0.8313342317 ×100 o o 0.8591409142 ≈ 3.236568305 o o

εt =

Using Romberg Approximation

h=

2 1− 0 1 = ; f ( x) = xe x 8 8

x against f ( x ) = xe x for Romberg Approximation with 8 subdivisions 2

Table 9. Values of x

0

1 8

1 4

3 8

f ( x)

0

0.1269684636

0.2661236147

0.4316223543

1 2 0.6420127083

5 8 0.9236901221

3 4 1.316290993

Using trapezoidal rule with 1 subdivision.

h= 1

1− 0 =1 1

T1 = ∫ xe x dx = 2

0

1 h( f 0 + f 8 ) 2

1 ⇒ T1 = .1(0 + e ) 2 = 1.359140914 Using trapezoidal rule with 2 subdivisions.

h= 1

T2 = ∫ xe x dx = 2

0

( )

1− 0 1 = 2 2

1 h( f 0 + 2 f 4 + f 8 ) 2

1 1 (0 + 2(0.6420127083) + 2.718281828) 2 2 = 1.000576811

⇒ T2 =

Applied and Computational Mathematics 2017; 6(1): 1-33

21

Using trapezoidal rule with 4 subdivisions.

h=

1− 0 1 = 4 4

1 2 1 T4 = ∫ xex dx = h( f0 + 2( f2 + f4 + f6 ) + f8 ) 2 0   0.2661236147   1  + e  ⇒ T4 = 1  0 + 2 + + 0 . 6420127083 1.31629099 3 2 4    = 0.8958920576

( )

Using trapezoidal rule with 8 subdivisions.

h= 1 T8 =



xe

0

1− 0 1 = 8 8

   f1 + f 2 + f 3  x 2 dx = 1 h  f + 2  + f + f + f  + f  0 4 5 6 8 2   + f  7    

  0.12696846 36 + 0.26612361 47     + 0.43162235 43 + 0 . 6420127083 1 1  0 + 2 ⇒ T8 = + 0.92369012 21 + 1.31629099 3 8   2  + 1.88154567 6    + e  = 0 . 8684243558

( )

        

Now, using Romberg approximation, we apply the iterative formula below to obtain the Romberg extrapolates as shown below T2 N ,i +1 = Table 10. Values of N 1

TN 1.359140914

2

1.000576811

4T2 N ,i − TN ,i 3

x against f ( x ) = xe x for Romberg Approximation Iterative formula with 8 subdivisions. 2

T2N,1

T2N,2

T2N,3

0.8810554433 0.8543110386 0.8609971398 4

0.8958920576

8

0.8684243558

0.8601526231 0.858692227

0.8592684552

So the Romberg approximation gives

1 I =

∫ xe

x 2 dx = 0.86015262 31

0

0.8591409142 − 0.8601526231 × 100 o o 0.8591409142 ≈ 1.17758199 × 10 −1 o o

εt =

22

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

Using Boole’s rule with n = 4 1

h=

I= I=

= 0 .25

4

2h ( 7 y0 + 32 y1 + 12 y2 + 32 y3 + 7 y4 ) 45

2 × (0 .25 ) ( 7 × 0 + 32 × 0 .266124 + 12 × 0.642013 + 32 × 1 .316291 + 7 × 2 .718282 ) 45

I = 0 .859659919

εt =

0.8591409142 − 0.859659919 × 100 o o 0.8591409142

≈ 6.041 × 10−2 o o Using Boole’s rule with n = 8 h=

I=

I=

1

8

= 0 .125

2h [7 y0 + 32( y1 + y3 + y5 + y7 ) + 12( y2 + y6 ) + 14 y4 + 7 y8 ] 45

 2 × (0.125)  7 × 0 + 32(0.126968 + 0.431622 + 0.92369 + 1.881246)   45  +12(0.266124 + 1.316291) + (14 × 0.642013) + (7 × 2.718282)  I = 0 .859153

εt =

0.8591409142 − 0.859153 × 100 o o 0.8591409142

≈ 1.431129 × 10−3 o o Using weddles ’s rule with n = 6 h=

I=

I=

1

6

= 0 .16667

3h [ y0 + 5 y1 + y2 + 6 y3 + y4 + 5 y5 + y6 ] 10

3 × 0 .1667 [0 + 5 × 0.171397 + 0.372597 + 6 × 0.642205 + 1.040142 + 5 × 1.669628 + 2.719913 ] 10 I = 0 .859568

εt =

0.8591409142 − 0.859568 × 100 o o 0.8591409142

≈ 4.968 × 10−2 o o Using the 2-point DIAF

Applied and Computational Mathematics 2017; 6(1): 1-33

N=2;

1

So that, I = xe x2 dx = ∫ 0

( )

2 1 8 45

8

∑λ k =0

k

h=

23

1− 0 1 2 = ; f ( x) = xe x ; w( x ) = 1 4(2) 8

k f  8

(

)

7, if k = {0,8} where Then for the 2-point DIAF, the weights are given by λ =  k  y, otherwise     2k + (−2)k  k −1   y = 32 + ( −1)    r 2k −1  r  2k + 1 −     2 5  2 9   

(

)

            

and r = k mod4

λ =7 0

      1 1    2 + (−2)  1−1      2 2 λ1 =  32 + ( − 1) 2 + (−2)   1−1 1    2 − 1    1  2    λ =  32 + ( − 1)    1 2  + 1−  2 2 −1 2     2 5   2  2    2  9       2 2 + 1 −      2 5   2  9             0   3   2 = 32 +  = 32  = 12 = 32 −   0   12  2  2 5  5      ,

(

)

(

     3 −1  λ 3 =  3 2 + ( − 1)       

  2 + (−2)  3    3 2 3 −1  3  2   + 1−     2 5 2 9     

(

3

3

  0 = 32 +  3 − 1 3 3 2 32  + 1−   2 9  2 5

   = 32   

     4 −1  λ 4 =  3 2 + ( − 1)       

   = 32 −    

2

5

 24     9 

(2

4

+ (−2)

4

)

)

4  0 2 4 − 1  0  2   + 1−    2 9    2 5 

    = 14   

      

)

24

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

Similarly, it follows that on substitution:

λ5 = 32, λ = 12, λ7 = 32, λ = 7 6 8 Thus

( )

   1 2 7 0e 0 2  + 32 1 e 8    8                    3 2  1 2   1 + 12 e 4  + 32 3 e 8   4 8       1 2       8 ⇒I=   2 45  2    5 1     + 14 1 e 2  + 32 5 e 8      2   8          2 2     7 3     3 1   + 12 4 e 4  + 32 7 8 e 8  + 7 e                7(0 ) + 32(0.1269684636 ) +    1 12(0.2661236147 ) + 32(0.4316223543)  ⇒I=  180 + 14(0.6420127083) + 32(0.9236901221)     + 12(1.316290993) + 32(1.881545676 ) + 7(e )   = 0.8591532096

( )

εt =

( )

( )

( )

( )

( )

( )

0.8591409142 − 0.8591532096 × 100 o o 0.8591409142

≈ 1.431123 × 10 −2 o o π

2

∫e

x

cos xdx

0

The exact solution of π

I=

2

∫e

x

cos xdx

(36)

u = cos x dv = e x dx   ⇒ du = − sin xdx ⇒ v = e x 

(37)

0

analytically is as follows Using integration by parts, put

Then by integration by parts, it follows that I = e x cos x

]

π

π 2

0

+

2

∫e 0

Further put

dv = e x dx  u = sin x  − − − − − − − − − −(ii ) ⇒ du = cos xdx ⇒ v = e x 

x

sin xdx

Applied and Computational Mathematics 2017; 6(1): 1-33

[

]

π

π

25

2

⇒ I = e cos x + e sin x 0 − ∫ e x cos xdx x

x

2

[

0

]

π

π ⇒ I = 1 e x cos x + e x sin x 0 2 = 1  e 2 − 1 2 2  ⇒ I = 1.90523869

Using Gauss-Chebyshev 3 point formula π

2

∫e

I=

x

cos xdx

(38)

0

b−a  b+a  We first transform the interval [0, π ] onto [−1,1] using the transformation x =  t +   where a = 0 and 2  2   2 ,

b =π

2

⇒ x =π

4(

t + 1)

,

⇒ dx = π dt − − − − − − − − − − − − − (ii ) * 4

(

1

(39)

)

π ( t +1) cos π ( t + 1) dt . Substituting equation (ii ) * into (i ) * yields, I = ∫ π .e 4 4 4 −1

1 π Then by Gauss-Chebyshev 3 point formula I = ∫ f (t )dt = 3 −1 = π .e 4 1− t f (t )

here

π

2

4(

t +1)

(

cos π

4(

t + 1)

)

(

)

 f 

 3   + f ( 0 ) +  2 

 3  f −  ,   2  

.

π ( t +1) ⇒ f (t ) = π .e 4 1 − t 2 cos π ( t + 1) 4 4 2  π  − 3 +1    e 4  2  1 −  − 3  cos  π  − 3 + 1    2      4 2        π  π ( 0 +1)  ⇒ I = .π  + e 4 1 − 02 cos π ( 0 + 1)  4 4 3   2  3   π 4  2 +1        3 3  1−  cos  π  + 1    +e   2    4 2         π 2 0.5524070987 + 1.550883197  Thus, =   12  +0.22738974 

(

)

= 1.916907495

εt =

1.90523869 − 1.916907495 × 100 o o 1.90523869

≈ 6.12458943 × 10 −1 o o Using Gauss-Legendre 3 point formula π

I=

2

∫e

x

cos xdx

0

b−a  b+a  We first transform the interval [0, π ] onto [−1,1] using the transformation x =  t +   where a = 0 2  2   2 ,

(40)

26

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

and b = π

2

⇒ x =π

4(

t + 1)

,

⇒ dx = π dt − − − − − − − − − − − − − (ii ) * 4

(

1

(41)

)

π ( t +1) cos π ( t + 1) dt . Substituting equation (ii ) * into (i ) * yields, I = ∫ π .e 4 4 4 −1

1 1 Then by Gauss-Legendre 3 point formula I = ∫ f (t )dt = 5 f 9  −1 π ( t +1) here f (t ) = π .e 4 cos π ( t + 1) . 4 4 Thus,

(

 3  −  + 8 f ( 0 ) + 5 f  5

)

 3    ,  5  

   3  +1  π 4  −   5.e  5  cos  π  − 3 + 1   4  5       π   (0 +1) π 1  ( ⇒ I = .π  + 8e 4 cos 0 + 1) 4 9 4     3  π  +1   4     + 5e  5  cos π  3 + 1    4  5         π 5.875062405 + 12.40706558  =  36 + 3.548573471  = 1.905088092

(

εt =

)

1.90523869 − 1.905088092 × 100 o o 1.90523869

≈ 7.90443 × 10 −3 o o Using Simpson’s 3/8 rule with 8 subdivisions

h= Table 11. Values of x

0

f ( x)

1

π −0 2 8

x against

π

π

16

8

1.19356881

5π 16 1.482881951

=

π

x 16 ; f ( x ) = e cos x

f ( x ) = e x cos x for Simpson’s 3/8 rule with 8 subdivisions.

1.368240338 3π 8 1.243027662

3π 16

1.498535197 7π 16 0.7711704511

Then by Sympson’s 3/8 rule. b 3h  f0 + 3( f1 + f2 + f4 + f5 + f7 + f8 + − − − + f3N −2   ∫ f ( x)dx =  a 8  + f3 N −1) + 2( f3 + f6 + f9 + − − − + f3 N −3 ) + f3N 

π 4

1.550883197

π 0

2

Applied and Computational Mathematics 2017; 6(1): 1-33

27

Thus for 8 subdivisions we have,

π I=

2



e x cos xdx =

0

  f1 + f 2    3h  f 0 + 3 + f + f + f  5 7   4 8    + 2( f 3 + f 6 ) + f 8 

  1.19356881 + 1.368240338      1 3 +  π 3  + 1.550883197 + 1.482881951  x I = ∫ e cos xdx =  + 0.7711704511  128    0  + 2(1.498535197 + 1.243027662 ) + 0    I = 1.883730368

π

2

1.90523869 − 1.883730368 ×100 o o 1.90523869 ≈ 1.128904325 o o

εt =

Using Romberg Approximation

h= Table 12. Values of x

f ( x) π 4 1.550883197

0 1

π −0 2 8

=

π ; f ( x) = e x cos x

16

f ( x ) = e x cos x for Rombeg Integration with 8 subdivisions.

x against

π

π

16

8

1.19356881

3π 16

1.368240338

5π 16 1.482881951

1.498535197

3π 8 1.243027662

7π 16 0.7711704511

Using trapezoidal rule with 1 subdivision.

h=

π −0 2 1



2

π 2

T1 = ∫ e x cos xdx = 0

1 h( f 0 + f 8 ) 2

1 π ⇒ T1 = . (1 + 0 ) 2 2 = 0.7853981634 Using trapezoidal rule with 2 subdivisions.

h=

π −0 2 2



4

π 0

2

28

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

π

2 1 T2 = ∫ e x cos xdx = h( f 0 + 2 f 4 + f 8 ) 2 0

( )

1π (1 + 2(1.550883197) + 0) 2 4 = 1.610759896

⇒ T2 =

Using trapezoidal rule with 4 subdivisions.

h= π

2



T4 =

e x cos xdx =

0

π −0 2 4



8

1 h( f 0 + 2( f 2 + f 4 + f 6 ) + f8 ) 2

( )

  1.368240338 + 1.550883197  1π  1 + 2  + .0   8 2  + 1.243027662    = 1.830822494

⇒ T4 =

Using trapezoidal rule with 8 subdivisions.

h= π T8 =

2



e x cos xdx =

0

π −0 2 8



16

   f1 + f 2 + f 3     1  h f 0 + 2 + f 4 + f 5 + f 6  + f 8  2   + f   7   

   1.19356881 + 1.368240338         + 1.498535197 + 1.550883197 +    1π  ⇒ T8 = 1 + 2   + 0 1.482881951 + 2 16       1.243027662 + 0.7711704511         = 1.886586787

( )

Now, using Romberg approximation, we apply the iterative formula below to obtain the Romberg extrapolates as shown below T2 N ,i +1 = Table 13. Values of N 1

TN 0.7853981634

2

1.610759896

x against

4T2 N ,i − TN ,i 3

f ( x ) = e x cos x for Rombeg Iterative formula with 8 subdivisions.

T2N,1

T2N,2

T2N,3

1.885880474 1.910275433 1.904176693 4

1.830822494

8

1.886586787

1.903918343 1.905507615

1.905174885

π

So the Romberg approximation gives I =

2

∫e 0

x

cos xdx = 1.903918343

Applied and Computational Mathematics 2017; 6(1): 1-33

1.90523869 − 1.903918343 × 100 o o 1.90523869 ≈ 6.930089 × 10 − 2 o o

εt =

Using Boole’s rule with n = 4

h= I= I=

π

2 =π 4 8

2h ( 7 y0 + 32 y1 + 12 y2 + 32 y3 + 7 y4 ) 45

2 × (0 .3 9 2 8 5 7 ) 45

 7 × 1 + 3 2 × 1 .3 6 8 3 6 7 + 1 2 × 1 .5 5 0 8 8 3     + 3 2 × 1 .2 4 2 1 9 3 + 7 × − 0 .0 0 3 0 4 

I = 1 .905396

εt =

1.90523869 − 1.905396 × 100 o o 1.90523869

≈ 8.26 × 10−3 o o Using Boole’s rule with n = 8

h= I=

π

2= π 8 16

2h [7 y0 + 32( y1 + y3 + y5 + y7 ) + 12( y2 + y6 ) + 14 y4 + 7 y8 ] 45

 7 ×1+ 32(1.193644 +1.498653 + 1.482591 2× (0.196429)   I=  +0.769451) + 12(1.368367 + 1.242193)  I = 1 .90524 45  +(14 ×1.550883) + (7 ×−0.00304)   

εt =

1.90523869 − 1.90524 × 100 o o 1.90523869

≈ 9.38631 × 10 −5 o o Using weddles ’s rule with n = 6

h= I=

I=

π

2= π 6 12

3h [ y0 + 5 y1 + y2 + 6 y3 + y4 + 5 y5 + y6 ] 10

3× 0.261905 1+ 5×1.255091+1.462061+ 6×1.550883 +1.424387 + 5×0.956886 +−0.00304  10   I = 1 .905246

29

30

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

εt =

1.90523869 − 1.905246 × 100 o o 1.90523869

≈ 4.0 × 10−4 o o Using the 2-point DIAF π −0 π N=2; h = 2 ; f ( x) = e x cos x ; w( x) = 1 = 4(2) 16 π

So that, I =

2

∫ e cos xdx = x

0

( 16)

2 π

45

8

∑λ k =0

k

πk  f   16 

(

7, if k = {0,8} Then for the 2-point DIAF, the weights are given by λ =  k  y, otherwise     2k + (−2)k  k −1   where y = 32 + ( −1)    r 2k −1  r  2k + 1 −     2 5  2 9   

)

(

)

            

and r = k mod4

λ0 = 7          1 1    2 + (−2) 2 2     2 + (−2) 1−1    2 − 1   λ1 = 32 + ( −1)   λ = 32 + −1   ( ) 1 1 1 −      1 2 2   12   2 22−1  2  22     + 1 −    2  9    + 1 −        2 5      ,   2 5   2  9               3   2  0  = 32 −  = 12 = 32 +   = 32  2  0  12         5  2 5    

(

)

(

      3 3 2 + (−2)   3−1  λ3 = 32 + ( −1)      3 23−1  3  23    + 1 −        2 5  2  9      

)

(

  0 = 32 +  3−1 3 3 2  32   2 5 + 1 − 2  9   

   = 32    

)

Applied and Computational Mathematics 2017; 6(1): 1-33

31

      4 4 2 + ( −2)   4−1  λ4 = 32 + ( −1)      0 24−1  0  24    + 1 −       2 5  2  9       

)

(

   25 = 32 −    24    9 

    = 14    

Similarly, it follows that on substitution:

λ5 = 32, λ6 = 12, λ7 = 32, λ8 = 7 Thus,

(

( ( ))

( ))

)

7 e0 cos 0 + 32 eπ 16 cos π  ( )  16    π +12 e 8 cos π  8     3π +32 e 16 cos 3π 16    π   4 π +14 e cos 2 π  4   16 ⇒I =   5 π 45 +32 e 16 cos 5π  16     3π +12 e 8 cos 3π 8    7π   16 π 7 cos +32 e  16   π +7 e 2 cos π  2    7 (1) + 32 (1.19356881)     +12 (1.368240338)     +32 (1.498535197 )  π   ⇒I = +14 (1.550883197 )  360   +32 (1.482881951)     +12 (1.243027662 )     +32 ( 0.7711704511) + 7 ( 0 )    = 1.905241431

( )

(

εt =

( ( ( ( ( (

(

))

( )) ( )) ( )) ( )) ( ))

1.90523869 − 1.905241431 × 100 o o 1.90523869

≈ 1.43843 × 10−4 o o Table 14. Summary of the Test Results. Integral

Formula 2-Point DIAF Gauss-Chebyshev 3 Point Gauss-Legendre 3 Point Simpson’s 3/8 Rule with 8 Subdivisions

Integral Value 0.693147901 0.729864959 0.693121693 0.684854208

Error 1.0394 × 10-4% 5.30% 3.6771×10-3% 1.20%

32

Integral

Francis Oketch Ochieng’ et al.: The N-Point Definite Integral Approximation Formula (N-POINT DIAF)

Formula Romberg Approximation Trapezoidal rule with 4 subdivisions Trapezoidal rule with 8 subdivisions Boole’s rule with n = 4 Boole’s rule with n = 8 Weddles’s rule with n = 6 2-Point DIAF Gauss-Chebyshev 3 Point Gauss-Legendre 3 Point Simpson’s 3/8 Rule with 8 Subdivisions Romberg Approximation Trapezoidal rule with 4 subdivisions Trapezoidal rule with 8 subdivisions Boole’s rule with n = 4 Boole’s rule with n = 8 Weddles ’s rule with n = 6 2-Point DIAF Gauss-Chebyshev 3 Point Gauss-Legendre 3 Point Simpson’s 3/8 Rule with 8 Subdivisions Romberg Approximation Trapezoidal rule with 4 subdivisions Trapezoidal rule with 8 subdivisions Boole’s rule with n = 4 Boole’s rule with n = 8 Weddles ’s rule with n = 6 2-Point DIAF Gauss-Chebyshev 3 Point Gauss-Legendre 3 Point Simpson’s 3/8 Rule with 8 Subdivisions Romberg Approximation Trapezoidal rule with 4 subdivisions Trapezoidal rule with 8 subdivisions Boole’s rule with n = 4 Boole’s rule with n = 8 Weddles ’s rule with n = 6

4. Precision and Stability Definition 4.1: The degree of accuracy or precision of a quadrature formula is the largest positive integer n such that the formula is exact for x k , for each k = 0,1, 2,......, n . Trapezoidal rule has degree of accuracy one while Simpson’s rule has degree of accuracy three. Remark: The degree of precision of a quadrature formula is n if and only if the error is zero for all polynomials of degree k = 0,1,......, n , but is NOT zero for some polynomial of degree n + 1 . Remark: N is even, degree of precision is N + 1 . N is odd, degree of precision is N For the N-point Definite Integral Approximation Formula (N-point DIAF), if N = 2 then the degree of precision is three while if N = 3 then the degree of precision is three. In addition to having a stable problem, i.e., a problem for which small changes in the initial conditions elicit only small changes in the solution, there are two basic notions of numerical stability. The first notion of stability is concerned with the behaviour of the numerical solution for a fixed value t > 0 as h → 0 . Definition 4.2 A numerical integration method is zero stable if small perturbations in the initial conditions do not cause the numerical approximation to diverge away from the true solution provided the true solution of the initial value

Integral Value 0.684854208 0.697023809 0.69412185 0.693175 0.693148 0.693149114 2.394157677 2.510109434 2.394157585 2.357143764 2.394159716 2.396978131 2.394862894 2.394158 2.394158 2.394703395 0.85915321 0.937104158 0.858654942 0.831334232 0.860152623 0.895892058 0.868424356 0.859659919 0.859153 0.859568 1.90524143 1.916907495 1.905088092 1.883730368 1.903918343 1.830822494 1.886586787 1.905396 1.90524 1.905246

Error 8.985847× 10-3% 5.59279344 x10-1% 1.40615158 x10-1% 4.013578 x10-3% 1.40615158 x10-1% 2.79072 x10-4% 8.3537x10-8% 4.84% 3.74926x10-6% 1.55% 8.5249 x10-5% 1.17805774843x10-1% 2.945582938684 x10-2% 3.97451 x10-6% 3.97451 x10-6% 2.2793832 x10-2% 1.431123 x10-3% 9.07% 5.6564938 x10-2% 3.24% 1.17758199 x10-1% 4.28% 1.08% 6.041 x10-2% 1.431129 x10-3% 4.968 x10-2% 1.43843 x10-4% 6.12458943 x10-1% 7.90443 x10-3% 1.13% 6.930089 x10-2% 3.91% 9.7897986 x10-1% 8.26x10-2% 9.38631x10-5% 4.0x10-4%

problem is bounded. For a consistent s-step method one can show that the notion of stability and the fact that its characteristic polynomial ρ satisfies the root condition are equivalent. Therefore, as mentioned earlier, for an s-step method we have convergence ⇔ consistent & stable. This concept of stability also plays an important role in determining the global truncation error. In fact, for a convergent (consistent and stable) method the local truncation errors add up as expected, i.e., a convergent s-step

(

method with Ο h p +1

( )

)

local truncation error has a global

error of order Ο h p . The N-point Definite Integral Approximation Formula (Npoint DIAF) is stable order p = 0 and unstable at p = N + 1 . Thus, N-DIAF method is only conditionally stable, i.e., the step size has to be chosen sufficiently small to ensure stability.

5. Conclusion From the above tests, it is evident that the 2-Point DIAF has the lowest relative error compared to other numerical integration techniques. As such it gives a better approximate solution to the integration i.e. it easily converges to the exact value [10] and is more stable.

Applied and Computational Mathematics 2017; 6(1): 1-33

33

Recommendations A comparison with other numerical integration methods, such as according to [7] Gauss-Legendre 3 point formula, Gauss-Chebyshev 3 point formula, Simpson’s Rule, and Romberg method, demonstrated that the N-point DIAF gives a better precision, as depicted by the test problem above. The error involved in using the N-point DIAF is the least. It is therefore recommended that the Npoint DIAF should be implemented by Scientists and Engineers to help in approximating definite integrals especially those that cannot be evaluated using analytical techniques.

Acknowledgements My thanks to the many authors of books, papers, and articles as well as a new generation of contributors to electronic media (the World Wide Web) who have provided us with additional insight and ideas. Special thanks and acknowledgement also go to my lecturer, Mr. Nicholas M. Muthama of Taita Taveta University, for having imparted me with the necessary knowledge and skills to be able to apply while discovering this formula and also for his insightful, constructive, and valuable comments. I also wish to thank Mr. Nicholas Mutothya for his contribution in an attempt to compare the N-point DIAF with the neighborhood method used in Regression Analysis (i.e. the k-Nearest Neighbors Regression algorithm). Special thanks go to Prof. Hamadi Boga, the Vice Chancellor Taita Taveta University for his support towards completion of this research.

References [1]

Burden, R. L. and Faires, J. D., Numerical Analysis, 9th ed., Brooks/Cole, Pacific Grove, 2011. pp 193-256.

[2]

C. -H. Yu, Solving some integrals with Maple, International Journal of Research in Aeronautical and Mechanical Engineering, Vol. 1, Issue. 3, pp. 29-35, 2013.

[3]

Dukkipati, R. V., Numerical Methods, New Age International Publishers (P) Ltd., New Delhi, India, 2010. Pp 237-263.

[4]

Gordon K. Smyth (1998), Numerical Integration, Encyclopedia of Biostatistics (ISBN 0471 975761), John Wiley & Sons, Ltd, Chichester.

[5]

Gupta, C. B and Malik, A. K. (2009), Advanced Mathematics, (New Age International Publishers) Pp 90-101.

[6]

Jain, M. K., S. R. K. Iyengar., and R. K. Jain, Numerical Methods for Scientific and Engineering Computation, Sixth Edition, New Age International Publishers, (Formerly Wiley Eastern Limited), New Delhi, 2008. Pp 128-177.

[7]

Jain, M. K., S. R. K. Iyengar., and R. K. Jain, Numerical Methods for Scientific and Engineering Computation, Sixth Edition, New Age International Publishers, (Formerly Wiley Eastern Limited), New Delhi, 2012. Pp 128-177.

[8]

K. E. Atkinson, An Introduction to Numerical Analysis, John Wiley and Sons, New York, NY, USA, Second Edition, 1989.

[9]

Rao, G. S. (2006), Numerical Analysis, Revised Third Edition (New Age International (P) Limited Publishers).

[10] T. Ramachandran, R. Parimala (2015), Open Newton - Cotes Quadrature With Midpoint Derivative For Integration Of Algebraic Functions, International Journal of Research in Engineering and Technology, Volume: 04 Issue: 10.