You are on page 1of 25

Numerical Integration

Chapter 4
11/10/2014

Numerical Integration
If
Function f(x) continuous on [a, b];
Its primitive, F(x), is known,
Then, the defined integral,

I f x dx Fb Fa
a
11/10/2014

Numerical Integration
When do we need it?

Function f(x) defined by a table;

or

The finding out of f(x) primitive, F(x), by using


analytical methods, involves a computing
significant effort f(x) will be evaluated for
several arguments, the problem becoming a
first case problem).

11/10/2014

Numerical Integration
Cuadrature numerical computing of
the simple integrals;
Cubature - numerical computing of the
duble integrals.

11/10/2014

Numerical Integration
4.1 Newton-Cotes Cuadrature Formulae

We are requested to compute the


following defined integral:
b

I f x dx
a

11/10/2014

Numerical Integration
4.1 Newton-Cotes Cuadrature Formulae
1. The interval [a, b] is divided in n-1 equal subintervals of length

ba
h
n 1
by the points

x i a (i 1)h, i 1,2,..., n
h

a=x1
11/10/2014

x2

x3

xn-1 b=xn
6

Numerical Integration
4.1 Newton-Cotes Cuadrature Formulae
2. Its assumed that the values of the function f(x) are known for the
arguments xi,

y i f x i , i 1,2,..., n
The function f(x) will be modeled by Lagrange formula of
interpolation.

x x
n

L n 1 x
i 1

ji
n

xj

yi

ji

11/10/2014

Numerical Integration
4.1 Newton-Cotes Cuadrature Formulae

The xi points network - EQUIDISTANT


The following notation is introduced:

The produces from the Lagrange interpolation

x x1
q
h

formula become:

x x h q j 1
n

n 1

ji

ji

n i n 1
(
x

x
)

1
)
h (i 1)!(n i)!
i j
ji

11/10/2014

Numerical Integration
4.1 Newton-Cotes Cuadrature Formulae

Lagrange interpolation formula is now:

L n 1 x
i 1

11/10/2014

q j 1
ji
n i

(1)

(i 1)!(n i)!

yi

Numerical Integration
4.1 Newton-Cotes Cuadrature Formulae
3. If its considered that:
b

f x dx L
a

n 1

( x )dx

The following cuadrature formula results:


b

f x dx A y
a

11/10/2014

i 1

10

Numerical Integration
4.1 Newton-Cotes Cuadrature Formulae
b

f x dx A y
i 1

where,

Change of variable x
n

q j 1dx

Ai
a

j i
n i

(1)

11/10/2014

(i 1)! (n i)!

n 1

j i
n i

q j 1dq

( 1)

(i 1)! (n i)!
11

Numerical Integration
4.1 Newton-Cotes Cuadrature Formulae
The Ai coefficients have the form:

A i (b a )H i
where
n 1

Hi

q j 1dq

(1)

0 ji
n i

(i 1)! (n i)!(n 1)

i 1,2,...,n

Now, the Newton-Cotes cuadrature formula can be obtained:


b

f x dx (b a ) H y
a
11/10/2014

i 1

i
12

Numerical Integration
4.1 Newton-Cotes Cuadrature Formulae
The Hi coefficients Cotes coeffficients
Characteristics
1. n

H
i 1

2.

H i H n i1

Remark
The Hi coefficients are independent of:
the function to be integrated, f(x);
the integration interval.

11/10/2014

13

Numerical Integration
4.2 Trapezoidal Rule
By considering for the NC coefficients,
n 1 n

Hi

q j 1dq

(1)

0 ji
n i

(i 1)!(n i)!(n 1)

i 1,2,...,n

n=2, the following values for the Cotes


coefficients are obtained:
1

1
H1 (q 1)dq
2
0
11/10/2014

1
H 2 qdq
2
0
14

Numerical Integration
4.2 Trapezoidal Rule
NC Formula
b

f x dx (b a ) H y
a

i 1

h
a f x dx 2 ( y1 y 2 )

11/10/2014

15

Numerical Integration
4.2 Trapezoidal Rule
NC Formula
b

f x dx (b a ) H y
a

i 1

h
a f x dx 2 ( y1 y 2 )
Practically, the Trapezoidal Rule is of no interest.
11/10/2014

16

Numerical Integration
4.2 Trapezoidal Rule
By generalizing,

Cuadrature formula of
practical interest.

THE GENERALIZED
TRAPEZOIDAL RULE

11/10/2014

17

Numerical Integration
4.2 Trapezoidal Rule
h

Procedure

a=x1

h
x2

x3

xn-1

b=xn

The interval [a, b] is divided in n-1 equal subintervals of


length h=(b-a)/(n-1), , by considering n equidistant
points:

x i a (i 1)h, i 1,2,...n
The Trapezoidal Rule will be used on each subinterval
[xi, xi+1], i=1, ..., n-1.
b

h
h
f ( x )dx ( y1 y 2 ) ... ( y n 1 y n )

2
2
11/10/2014
a

18

Numerical Integration
4.2 Trapezoidal Rule
where,
f(xi)=yi, i=1, 2, ..., n.

yn
y1 n 1
yi
a f (x)dx h 2
2
i 2
b

11/10/2014

19

Numerical Integration
4.2 Trapezoidal Rule

Geometrically, this formula assumes the replacement of the


functions graph by a polygonal line to link the points (x1,
y1), ..., (xi, yi),..., (xn, yn).
11/10/2014

20

Numerical Integration
4.3 Simpsons Rule
Better accuracy than the trapezoidal rule
It comes from the NC formula for n=3
2

1
1
H1 H3 (q 1)(q 2)dq
40
6

12
2
H 2 q(q 2)dq
20
3
11/10/2014

21

Numerical Integration
4.3 Simpsons Rule
Considering b-a = x3-x1=2h

y=f(x)

y=L2(x)

x3

h
f (x)dx 3 ( y1 4y 2 y3)
x
1

Geometrically, the formula assumes the replacement of the


curve y=f(x) by a parabola y=L2(x)
11/10/2014

22

Numerical Integration
4.3 Simpsons Rule
The approximation accuracy can be improved by
using the GENERALIZED SIMPSONS RULE.

11/10/2014

23

Numerical Integration
4.3 Simpsons Rule
h

Procedure

a=x1

h
x2

x3

xn-1

b=xn

The interval [a, b] is divided in n-1 equal


subintervals of length h=(b-a)/(n-1), by n
equidistant points, where n is mandatory odd.

x i a (i 1)h, i 1,2,...n
On each double subinterval [x1, x3], [x3, x5], ...,
[xn-2, xn], the Simsons Rule is used.

11/10/2014

24

Numerical Integration
4.3 Simpsons Rule
b

h
h
h
a f (x)dx 3 (y1 4y 2 y3 ) 3 (y3 4y 4 y5 ) ... 3 (y n2 4y n1 y n )

h
ydx 3 ( y1 4 2 21 y n )
a
1
11/10/2014

( n 3) / 2

y 2i1
i 1

( n 1) / 2

y
i 1

2i

25

You might also like