100% found this document useful (2 votes)
185 views26 pages

5.2 Numerical Integration: I FXD

The document discusses numerical integration techniques for approximating integrals of functions. It describes the trapezoidal rule, Simpson's 1/3 rule, and Simpson's 3/8 rule. The trapezoidal rule fits a linear polynomial between two data points to estimate the integral. Simpson's rules fit quadratic and cubic polynomials to three or four data points, respectively, achieving higher accuracy. The rules can be applied repeatedly in composite forms to subdivide intervals and further improve accuracy. Examples demonstrate using the rules to estimate integrals.

Uploaded by

Muhammad Firdaws
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
185 views26 pages

5.2 Numerical Integration: I FXD

The document discusses numerical integration techniques for approximating integrals of functions. It describes the trapezoidal rule, Simpson's 1/3 rule, and Simpson's 3/8 rule. The trapezoidal rule fits a linear polynomial between two data points to estimate the integral. Simpson's rules fit quadratic and cubic polynomials to three or four data points, respectively, achieving higher accuracy. The rules can be applied repeatedly in composite forms to subdivide intervals and further improve accuracy. Examples demonstrate using the rules to estimate integrals.

Uploaded by

Muhammad Firdaws
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

zar97/09/03

Numerical Methods For Engineers

page 5-16

5.2 Numerical Integration


There are many engineering problems that require the evaluation of the integral of the
functions. Many cases the indefinite form of the integral is not available. Therefore, we need
numerical approximation of integral by using approximating function (a process known as
integration or quadrature).

I=

a f (x )dx

(5.2-1)

where f (x) may be (1) a known function with or without exact integral or (2) a set of discrete
data.
When a function to be integrated does not have exact integral or is only known at a set of
discrete data, an approximating function is fit to the available data, or to several subsets of
the data (a process called composite integration), and the resulting polynomial is then
integrated.

I=

a f (x )dx a pn (x )dx

(5.2-2)

1. Integrating direct fit polynomial.. To estimate integral of the approximating


polynomial in certain discrete intervals. Recall eq.(4.2-1)

f ( x ) pn ( x ) = a0 + a1x + a2 x 2 + . . . + an x n
Eq.(5.2-2) becomes

a ( a0 + a1x + a2 x
b

+ . . . + an x n dx

(5.2-3)
b

a
a
a

I a0 x + 1 x 2 + 2 x 3 + . . . + n x n +1
n +1
2
3
a

(5.2-4)

zar97/09/03

Numerical Methods For Engineers

page 5-17

Using interpolating polynomial to estimate the integral


Example 5.2-1:

Use a first order and second-order Newtons interpolating polynomial to fit the
set of data given below and estimate the integral of the function using the
resulting interpolation polynomial in the limit of 3.2 x 5.0.
x
f(x)

2.0
0.5

5.0
0.2

8.0
0.125

Solution:
8.0

I 2.0 pn ( x )dx

True value = 1.38629.

p1 ( x ) = 0.375 0.0625x
I

8.0

2.0

(0.375 0.0625x ) dx

[(0.375x 0.03125x 2 )]82..00


16250
.
Percent true error,

t = 17.2 %

p2 ( x ) = 0.825 01875
.
x + 0.0125x 2
8.0

I 2.0 (0.825 01875


.
x + 0.0125x 2 ) dx
[(0.825x 0.09375x 2 + 0.00417 x 3 )]82..00
2.73504 1.30836
1.42668
Percent true error,

t = 2.9 %

zar97/09/03

Numerical Methods For Engineers

page 5-18

2. Newton-Cotes Integration Formulas.. These techniques are the most common


numerical integration scheme used. Two forms available: closed and open. The closed form
has the data points at the beginning and end of the integration limits while the open form has
the integration limits extend beyond the range of the data points. The open form is generally
used for improper integral and in the solution of ODEs.

I. Trapezoidal Rule: fitting a first order polynomial to two discrete data points.
Consider the Newton interpolating polynomial with a = x0 and b = x1 ,

p1 ( x ) = f ( x0 ) +

IT

a [ f ( x0 ) +

I T (b a )

f (b) f (a )
(x a )
ba

f (b) f (a )
( x a )] dx
ba

f (a ) + f (b)
2

or

(5.2-5)

h
[ f a + fb ]
2

h = b a and

Et =

f (a ) = f a , f (b) = f b

1
f ''( )h 3
12

(5.2-6)

Figure 5.2-2: Trapezoidal rule for a single interval.


Composite Trapezoidal Rule: A simple way to improve accuracy of the trapezoidal rule is to
divide the single interval into smaller subintervals. Eq.(5.2-6) is then applied to each
subinterval and the results are summed to yield an integral value for the entire region. For
n+1 data points there are n equally spaced subintervals. Denoting a = x0 and b = xn,
therefore, each segment has

h=

ba
n

(5.2-7)

zar97/09/03

Numerical Methods For Engineers

page 5-19

The integral may be written as


xn

b1

b2

bn

I T = x f ( x )dx x p1 ( x )dx + x p1 ( x )dx + . . . + x

n 1

p1 ( x )dx

(5.2-8)

which yields

IT h

f ( x1 ) + f ( x0 )
f ( x2 ) + f ( x1 )
f ( xn ) + f ( xn 1 )
+h
+ . . . +h
2
2
2

(5.2-9)

Rewriting in a more convenient form, we obtain

IT

h
( f 0 + 2 f1 + 2 f 2 + . . . + 2 f n 1 + f n ) or
2

n 1

h
f 0 + 2 f ( xi ) + f n

2
i =1

(5.2-10)

Using Newton-Cotes formulas to estimate the integral


Example 5.2-2:

Evaluate the integral of the following function using Trapezoidal rule from x
= 2.0 to 8.0 using (i) single interval and (ii) three subintervals.
f ( x) =

Solution:
(i)
At

x = 2.0,
x = 8.0,

1
x

f(2.0) = 0.5
f(8.0) = 0.125

Using eq.(5.2-6),

IT =

(6.0)
[0.5 + 0125
. ] = 1870
.
2

IT =

( 2.0)
[0.5 + 2(0.25) + 2( 016667
.
) + 0.125] = 1.45834
2

(ii)
Using eq.(5.2-10),

zar97/09/03

Numerical Methods For Engineers

page 5-20

II. Simpsons 1/3 Rule: Fitting a second-order polynomial to a set of three discrete data
points. Consider the 2nd-order Lagrange interpolating polynomial with a = x0 and b = x2 ,
the integral becomes

IS

x 2

x x0 x x2
x x0 x x1
x x1 x x2

f ( x0 ) +

f ( x1 ) +

f ( x2 ) dx
x1 x0 x1 x2
x2 x0 x2 x1
0 x1 x0 x2

x0 x

After integration and algebraic manipulation with h =

IS

h
[ f ( x0 ) + 4 f ( x1 ) + f ( x2 )]
3

or

ba
, the resulting expression is
2

h
[ f a + 4 fb + f 2 ]
3

(5.2-11)

This formula has a truncation error of

1 4
Et =
f ( )h5
90

or

(b a ) 5 4

f ()
2880

where a < < b.

Figure 5.2-3: A single application of Simpsons 1/3 rule.

(5.2-12)

zar97/09/03

Numerical Methods For Engineers

page 5-21

Composite Simpsons 1/3 rule: Similar to the trapezoidal rule, the Simpsons 1/3 rule
may be improved by applying the rule to equally spaced subintervals. The integral may be
written as

IS =

xn

b2

x4

x0 f ( x )dx x0 p2 ( x )dx + x2 p2 ( x)dx +

bn

. . . + x

n2

p2 ( x )dx

(5.2-13)

The resulting expression is

IS =

h
[ f ( x0 ) + 4 f ( x1 ) + 2 f ( x2 ) + . . . + 2 f ( xn 2 ) + 4 f ( xn 1 ) + f ( xn ) ]
3

where h =

(5.2-14)

ba
and xk = a + kh; k = 0,1,..., n . Note that the values of the function at the
n

interior points are weighted by 2 and 4. The total weighted function is scales by h/3.

Using Newton-Cotes formulas to estimate the integral

Evaluate the integral of the following function using Simpsons 1/3 rule from x
= 2.0 to 8.0 using (i) single application and (ii) multiple application with h = 1.2.

Example 5.2-2:

f ( x) =
Solution:
(i)

At

x = 2.0,
x = 5.0,
x = 8.0,

1
x
f(2.0) = 0.5
f(5.0) = 0.2
f(8.0) = 0.125

Using eq.(5.2-11),

IS =

( 3.0)
[0.5 + 4(0.2) + 0125
. ] = 14250
.
3

(ii) Using eq.(5.2-14),


IS =

(10
. )
[ 0.5 + 4( 0.33333) + 2( 0.25) + 4( 0.2) + 2(016667
.
) + 4( 014286
.
) + 0125
. ] = 1.3877
3

zar97/09/03

Numerical Methods For Engineers

page 5-22

Using Newton-Cotes Formulas to estimate the integral of the function:


Worksheet 5.2-1:

For f(x) = e , estimate the integral of the function for the limit -1 x 1. Use
(a) Trapezoidal rule and (b) Simpsons 1/3 rule. Use a step size h = 0.5 for
both methods.
x

Solution:

IS =

(a) Trapezoidal rule,

ex dx

True value = 2.3504.

for h = 0.5

and using eq.(5.2-10),

(0.5) 1.0
[ e + 2 e0.5 + 2 e0 + 2 e0.5 + e1.0 ]
2
(0.5)

[(0.36788) + 2(0.60653) + 2(10


. ) + 2(164872
.
) + (2.71828)]
2
2.39917

IT

(b) Simpsons 1/3 rule, for h = 0.5,

and using eq.(5.2-14),

( 0.5) 1
e + 4 e0.5 + 2 e0 + 4 e0.5 + e1
3
( 0.5)

[ (0.36788) + 4(0.60653) + 2(1.0) + 4(1.64872) + (2.71828)]


3
2.35119

IS

zar97/09/03

Numerical Methods For Engineers

page 5-23

III. Simpsons 3/8 Rule: Fit a third-order polynomial to a set of four discrete data points
and use it to approximate the integrand.

I =

f ( x) dx p3 ( x) dx

(5.2-15)

Denoting x0 = a and x3 = b and after integration and algebraic manipulation with h =

ba
,
3

the resulting expression is

IS

3h
h
[ f ( x0 ) + 3 f ( x1 ) + 3 f ( x2 ) + f ( x 3 )] or
[ f 0 + 3 f1 + 3 f 2 + f 3 ]
8
3

(5.2-16)

The truncation error for a single-application of this formula is

Et =

3 4
f ( )h 5
80

or

(b a ) 5 4
f ( )
6480

where a < < b.

(5.2-17)

Figure 5.2-3: A single application of Simpsons 1/3 rule.


Remark:

1. Error estimates for the Simpsons 3/8 rule is smaller than that of the
simpsons 1/3 rule.
2. 1/3 rule usually prefered since it attains the same order of accuracy while
using only three points on the curve.
3. 3/8 rule has an odd numder of segments as compared to an even number
of segments for the 1/3 rule.

zar97/09/03

Numerical Methods For Engineers

page 5-24

Note: Suppose you wish to to divide the interval into an odd number of segments, you may
employ
(1) a composite trapezoidal rule. However, it is not prefered due to a large TErs.
(2) Simpsons 3/8 rule.
(3) Simpsons 1/3 rule over an even number of segments and the 3/8 rule to the
remaining odd number of segments. This is the most prefered approach.

Composite Simpsons 1/3 and 3/8 rule: use to estimate the integral having an odd
number of inetrvals. The integral may be illustrate as

Figure 5.2-4: A multiple-application of Simpsons 1/3 and 3/8 rule.

zar97/09/03

Numerical Methods For Engineers

page 5-25

Using Newton-Cotes formulas to estimate the integral

Evaluate the integral of the following function from x = 2.0 to 8.0 using (i) a
single application Simpsons 3/8 rule and (ii) a multiple application 1/3 and 3/8 rule with n =
5.

Example 5.2-2:

f ( x) =

h=

Solution:

1
x

b a 8.0 2.0
=
= 2.0
3
3

(i)
2.0
0.5

x
f(x)

4.0
0.25

6.0
0.16667

8.0
0.125

Using eq.(5.2-16),

I S 3/ 8 =

3(2.0)
[0.5 + 3(0.25) + 3(016667
.
) + 0125
. ] = 14063
.
8

The percent true error is t = 1.44 %.

(ii) Using eq.(5.2-14) and (5.2-16) with 5 intervals, h =


x
f(x)

2.0
0.5

3.2
0.3125

4.4
0.22727

5.6
0.17857

6.8
0.14706

8.0
0.125

(12
. )
[0.5 + 4(0.3125) + (0.22727)] = 0.79091
3
3(12
. )
=
[0.22727 + 3(017857
.
) + 3( 014706
.
) + 0125
. ] = 0.59812
8

I S1/ 3 =
I S 3/ 8

8.0 2.0
= 12
.
5

I S = I S 1/ 3 + I S 3/ 8 = 0.79091 + 0.59812 = 1.38903


The percent true error is t = 0.197 %.

zar97/09/03

Numerical Methods For Engineers

page 5-26

Using Newton-Cotes Formulas to estimate the integral of the function:


Worksheet 5.2-2:

For f(x) = e , estimate the integral of the function for the limit -1 x 1. Use
(a) Simpsons 3/8 rule and (b) Simpsons 1/3 rule and 3/8 rule.
x

Solution:

IS =
(a) 3/8 rule,

ex dx

h=

for

True value = 2.3504.

1 ( 1) 2
= 3
3

and using eq.(5.2-16),

1
3(2 / 3) 1.0
1
+ 3e 3 + 3e 3 + e1.0 ]
[e
8
3( 2 / 3)

[(0.36788) + 3( 0.71653) + 3(139561


.
) + (2.71828)]
8
2.3556

I S 3/ 8

h=

(b) 1/3 and 3/8 rule, for

b a 1 ( 1)
=
= 0.4 and using eq.(5.2-14) and (5.2-16),
n
5

(0.4) 1
e + 4 e 0 . 6 + e 0 . 2
3
(0.4)

[(0.36788) + 4(0.54881) + (0.81873)]


3
0.45091

I S1/ 3

3(0.4) 0.2
e + 3e 0.2 + 3e 0.6 + e1.0
8
3(0.4)
.
) + 3(182212
.
) + (2.71828)]

[(0.81873) + 3(122140
8
.
190013

I S1/ 3

I S = I S 1/ 3 + I S 3/ 8 = 0.45091 + 190013
.
= 2.3510

zar97/09/03

Numerical Methods For Engineers

page 5-27

Remark about error estimation of Newton-Cotes Formulas:


The error estimate of the integral for functions with exact integral may be illustrated by the
following example. Consider the function

f ( x) = 3x5 + x4 + 2 x3 3x2 + x + 10
Estimate the error of the integral in the limit of 1 x 3 for each of the follwing methods (a)
Trapezoidal rule (b) Simpsons 1/3 rule and (c) Simpsons 3/8 rule.
Solution:

f '( x) = 15x4 + 4 x3 + 6x2 6x + 1


f ''( x) = 60x3 + 12 x 2 + 12 x 6
f 3 ( x) = 180x2 + 24 x + 12
f 4 ( x) = 360x + 24
(a) Trapezoidal rule,

1
f ''()h 3
12
''
f max ( x = 3) = 1482

Et =

or

(b a ) 3
f ''( )
12

where a < < b.

(b a ) 5 4

f ()
2880

where a < < b.

( 3 1) 3
Et =
( 1482) = 988
12
(b) Simpsons 1/3 rule,

1 4
Et =
f ( )h5
90
4
f max ( x = 3) = 1056
Et =

or

( 3 1)5
( 1056) = 11.73
2880

zar97/09/03

Numerical Methods For Engineers

page 5-28

Using Newton-Cotes Formulas to estimate the integral of the function:


Worksheet 5.2-2:

For f(x) = e , estimate the error of the integral for the limit -1 x 1. Use (a)
Simpsons 3/8 rule and (b) Simpsons 1/3 rule and 3/8 rule.
x

Solution:

f '( x) = e x

f ''( x) = e x

f 3 ( x) = e x

f 4 ( x) = e x

(a) 3/8 rule,

3 4
Et =
f ( ) h5
or
80
4
f max
( x = 1) = 2.7183
Et =

(b a ) 5 4

f ( )
6480

where a < < b.

[1 ( 1)]5
(2.7183) = 0.0134
6480

(b) Simpsons 1/3 rule,

(b a )5 4
4
f ( )
f max
( x = 0.2) = 0.81873.
2880
[ 0.2 ( 1)]5
Et =
(0.81873) = 0.000093
2880
Et =

(b a )5 4
4
Et =
f ( )
f max
( x = 1) = 2.7183.
6480
[1 ( 0.2)]5
Et =
(2.7183) = 0.00104
6480
Total error estimate Et = 0.00093 + 0.00104 = 0.00114.

zar97/09/03

Numerical Methods For Engineers

page 5-29

5.3 Integral of Equations


5.3.1 Romberg Integration.

This is a technique whereby the Richardson


extrapolation is used in the trapezoidal rule to give a high accuracy approximation to the
integral. Before we discuss this technique, lets look at an idea how an improvement can be
made. Recall the composite trapezoidal rule,

IT

h
( f 0 + 2 f1 + 2 f 2 + . . . + 2 f n 1 + f n ) or
2

where h =

n 1

h
f 0 + 2 f ( xi ) + f n (5.2-10)

2
i =1

ba
, x0 = a and xn = b. The error formula is given by
n
ET =

(b a )h 2
f ' '( )
12

where x 0 < < x n

(5.3-1)

Alternatively, eq.(5.3-1) can be expressed as

ET =

h2
(b a )h 4 4
f ( )
[ f '(b) f '(a )] +
12
720

where x 0 < < x n

(5.3-2)

Eq.(5.2-10) can be used to estimate the integral of the function in the following way,
Start:

h0 = b a
h1 = ho / 2
h2 = h1 / 2
h 3 = h2 / 2
M
hk =

hk 1 (b a ) (b a )
=
=
2
n
2k

(5.3-3)

zar97/09/03

Numerical Methods For Engineers

page 5-30

Denoting eq.(5.2-10) by Tk ,0 , we may then express it as

h
(b a )
[ f (a ) + f (b)] = 0 [ f a + f b ]
2
2
h
1 h0
T1,0 = 1 [ f (a ) + 2 f (a + h1 ) + f (b)] =
[ f a + f b ] + h1 f (a + h1 )
2
2 2
1
= T0 ,0 + h1 f (a + h1 )
2
h
T2 ,0 = 2 [ f (a ) + 2 f (a + h2 ) + 2 f (a + 2h2 ) + 2 f (a + 3h2 ) + f (b)]
2
1 h1
=
[ f a + 2 f (a + 2h2 ) + f b ] + h2 [ f (a + h2 ) + f (a + 3h2 )]
2 2
1
= T1,0 + h1 [ f (a + h2 ) + f (a + 3h2 )]
2
M
T0 ,0 =

(5.3-4)

In general we may write the above equation in a convenient form as


k 1

Tk ,0 =

2
1
Tk 1,0 + hk f (a + {2i 1}hk )
2
i =1

for

k = 1,2 ,...

(5.3-5)

which is an improve formula based on the value of previous integral. However, the above
formula gives a very slow improvement or convergence. It may be illustrated through the
following example
Using improved formula
Example 5.3-1:

Solution:

Evaluate the integral of the following function using eq.(5.3-5).


1 1
I = 0
dx
True value = 0.6931
1+ x
(1 0) 1
1
[
+
] = 0.75
2
1+ 0 1+ 1
1
0.75
T1,0 =
+ ( 0.5)[
] = 0.375 + 0.33333 = 0.70833
1 + 0.5
2
0.70833
1
1
T2 ,0 =
+ ( 0.25)[
+
] = 0.35417 + 0.34286 = 0.6970
2
1 + 0.25 1 + 0.75
T0,0 =

zar97/09/03

Numerical Methods For Engineers

page 5-31

Now we may introduce Romberg integration to make the convergence faster. It may be
represented as
I(1,1)
I(2,1)
I(3,1)
:
I(j,1)

I(2,2)
I(3,2)
:
I(j,2)

I(3,3)
:
I(j,3)

...

(5.3-6)

I(j,k)

In general, we may express Romberg integration in the form

I j ,k =

4 k 1 I j + 1, k 1 I j , k 1

(5.3-7)

4 k 1 1

Using Romberg Integration.


Example 5.3-2:

Evaluate the integral of the following function using Trapezoidal rule from x
= 2.0 to 8.0 using (i) single interval and (ii) three subintervals.
1
f ( x) =
x

Solution:
# Intervals

I(j,1)

I(j,2)

I(j,3)

I(j,4)

1
2
4
8

6.0
3.0
1.5
0.75

1.8750
1.5375
1.42809
1.39713

1.42500
1.39162
1.38681

1.38939
1.38649

1.38644

zar97/09/03

Numerical Methods For Engineers

page 5-32

Using Romberg Integration to estimate the integral of the function:


Worksheet 5.3-1:

For f(x) = e , using Romberg integration estimate the integral of the functrion
in the interval [-1,1]. Use up to 4 intervals.

Solution:
h
IT [ f a + fb ]
2
h
I T ( f 0 + 2 f 1 + 2 f 2 + . . . + 2 f n 1 + f n )
2

# Intervals

I(j,1)

I(j,2)

I(j,3)

I(j,4)

zar97/09/03

Numerical Methods For Engineers

page 5-33

5.3.2 Gauss Quadrature. Recall that in the Newton-Cotes Integration Formulas, the
formulas are based on the fixed base points.

(b a )
[ f (a ) + f (b)]
2

(5.3-8)

Now, suppose such a constraint of fixed base points is removed, we may get a better
location of the base points which minimizes the error as shown below.

Gauss quadrature is a technique employed to implement that strategy. The approach of our
interest is called Gauss-Legendre formulas.

I. Method of Undetermined Coefficient


To illustrate the approach, eq.(5.3-8) can be expressed as

I c0 f (a ) + c1 f (b)

(5.3-9)

where cs are the unknown constants. There are two situations for which eq.(5.3-8) and,
therefore eq.(5.309) yield the exact integral: y = f(x) = 1 and y = f(x) = x.

zar97/09/03

Numerical Methods For Engineers

f(x)

page 5-34

f(x)

(a)

(b)

Figure 5.3-1:Functions that have exact integral using trapezoidal rule.


Using trapezoidal rule, we can write

c0 f (a ) + c1 f (b) =

(b a )/ 2

1dx

c0 f (a ) + c1 f (b) = b a

(a)

(b a )/ 2

and
(b)

Solving eqs.(a) and (b) for the unknown coefficients yield

Substitute back into eq.(5.3-9), we have an equivalent equation to eq.(5.3-8),

ba
ba
f (a ) +
f (b)
2
2

(5.3-10)

zar97/09/03

Numerical Methods For Engineers

page 5-35

II. Derivation of the Two-Point Gauss-Legendre Formula.

The two-point

formula can be developed by rewriting eq.(5.3-9) as

I c0 f ( x0 ) + c1 f ( x1 )

(5.3-9)

The objective in Gauss quadrature is to determine the unknown coefficients cs and the
function arguments xs of the above equation.

Figure 5.3-3: Graphical depiction of unknown x0 and x1 for integration by Gauss


Quadrature.
The points x0 and x1 are not fixed at the end points, and they are the other two unknowns.
Therefore, there are four unknowns which require 4 conditions. We will will assume that the
equation will fit the integral of
(a) a constant function:
(b) a linear function:
(c) a parabolic function:
(d) a cubic function:

y=1
y=x
y = x2
y = x3

We may then write

c0 f ( x0 ) + c1 f ( x1 ) =
c0 f ( x0 ) + c1 f ( x1 ) =

1dx = 2

(a)

xdx = 0

(b)

1
1
1

zar97/09/03

Numerical Methods For Engineers

page 5-36

Solving eq.(a) through (d) for the unknowns yield

and thus, the two-point formula can be expressed as

I f (

1
)
3

+ f(

1
)
3

(h3)

Thus, we obtain an interesting addition of the function values at x =

(5.3-10)
1
3

and x =

1
3

that

gives an estimate of integral with a third-order-accurate. The limit of the integral x0 = a and
xn = b can be transformed into x0 = -1 and xn = 1 by performing a change of variable using
linear transformation in the following way,

x = a0 + a1 t

(5.3-11)

Let the lower limit x = a and t = -1, eq.(5.3-11) becomes

a = a0 a1

(5.3-11a)

Next, let the upper limit x = b and t = 1, eq.(5.3-11) becomes

b = a0 + a1

(5.3-11b)

Solving eqs.(5.3-11a and b) yields

a0 =

b+a
2

and

a1 =

ba
2

(5.3-12)

which can be substitute back into eq.(5.3-11) to give

x=

(b + a ) + (b a )t
2

(5.3-13)

Differentiating the above equation gives

dx =

ba
dt
2

(5.3-14)

zar97/09/03

Numerical Methods For Engineers

III. Higher-Point Gauss-Legendre Formulas.

page 5-37

Higher-point versions of Gauss-

Legendre Integration can be developed in the general form

I c0 f 0 + c1 f1 + c2 f 2 + . . . + cn 1 f n 1

(5.3-15)

where n is the number of points. The values of cs and xs for up to four point formulas
are given in table 5.3-1 below.
Table 5.3-1: Gauss quadrature parameters
Points
Weighting Factors
Function arguments

cs

xs

c0 = 1.0
c1 = 1.0

x0 = 1 3
x1 = 1 3

c0 = 5 9
c1 = 8 9
c2 = 5 9

x0 = 0.6
x1 = 0.0
x2 = 0.6

c0 = 0.347854845
c1 = 0.652145155
c2 = 0.347854845
c3 = 0.652145155

x0 = -0.861136312
x1 = -0.339981044
x2 = 0.339981044
x3 = 0.861136312

Error
Order

In general, we may represent the Gauss-Legendre formulas as

ba 1
b a n 1
I = f (x )dx
f (t )dt =
ci f (xi )

2 1
2 i =0
a
b

(5.3-16)

zar97/09/03

Numerical Methods For Engineers

page 5-38

Using Gauss Quadrature.


Example 5.3-3:

Evaluate the integral of the following function using the two- and three-point
Gauss Quadrature from x = 2.0 to 8.0.
f ( x) =

1
x

Solution:
Using eq.(5.3-13), x = 3t + 5

and thus,

f (t ) =

1
3t + 5

Two-point formula,

(8 2 ) 1
I
. ) f (
f (t )dt = (3.0) (10
2 1

I (3.0)[

1
3( 1

3) + 5

1
)+
3

(10
. )f (

1
)
3

1
] = 1.36364
3(1 3 ) + 5

Three-point formula,

5
8
(8 2 ) 1
5

I
f (t )dt = (3.0) f ( 0.6 ) + f (0) + f ( 0.6 )

9
9
2 1

5
8 1 5

1
1
I (3.0)
+
= 1.38367
+
9 3( 0.6 ) + 5 9 3(0) + 5 9 3( 0.6 ) + 5

zar97/09/03

Numerical Methods For Engineers

page 5-39

Using Gauss-legendre formula


Worksheet 5.3-2:

Solution:

For f(x) = e , using the two-point Gauss-Legndre formula to estimate the


integral of the functrion in the interval [-1,1].

zar97/09/03

Numerical Methods For Engineers

page 5-40

5.4 Open Integration Formulas. The open integration formulas are used when the
integral limits extend beyond the range of the data.
I. Two-segments formula:

Figure 5.4-1: A midpoint method.


I. Three-segments formula:

Figure 5.4-2: A three-segment method.

zar97/09/03

Numerical Methods For Engineers

page 5-41

Table 5.4-1: Newton-Cotes open integration formulas with h = (b -a)/ n.

Segment
n

Point
(n - 1)

I (b a ) f ( x1 )

(b a )
f ( x1 ) + f ( x2 )]
2

(b a )
2 f ( x1 ) f ( x2 ) + 2 f ( x3 )]
3

(b a ) 11 f ( x1 ) + f ( x2 ) + f ( x3 ) + 11 f ( x4 )

4
6

95 5
h f
144

(b a ) 11 f ( x1 ) 14 f ( x2 ) + 26 f ( x3 ) 14 f ( x4 ) + 11 f ( x5 )

5
4

41 7
h f
140

Remark:

Formula

Truncation
Error
1 3
h f ' ' ( )
3
3 3
h f ' ' ( )
4
14 5
h f
45

(4)

(4)

( )

( 6)

( )

1. Even-segment formulas are usually prefered since fewer points are


required in order to attain the same accuracy as the odd-segment formulas.
2. Open formulas are rarely used for inetgration. However, they are often used
for improper integrals and in multistep methods for solving ODEs.

Improper integrals. Read the materials covered in section 16.3 (p.520).

( )

You might also like