Lecture 16
Lecture 16
Panchatcharam Mariappan1
1 Associate Professor
1
Numerical Integration: Introduction
• In school days or in your calculus course, you have studied the
integration.
• When a function in one variable is given and an interval is given, then
integration (under certain conditions) represents the area under the
curve.
• The dictionary meaning of integration is "to bring together as parts into a
whole; to unite; to indicate the total amount".
• Mathematically it represents the summation. When the sum is in discrete
P
sense we
use the symbol whereas for continuum cases, we represent
it with where this symbol is elongated and stylised ’S’.
2
Numerical Integration: Introduction
• The integration is represented by
b
I= f (x)dx (1)
a
which represents the integral of the function f (x) with respect to the
independent variable x, evaluated between the limits x = a to x = b. It
represents the summation of f (x)dx over the range x = a to x = b. From
below figure, the area under the curve f (x) between x = a and x = b is given
by A(f ).
3
Numerical Integration: Riemann Sum
4
Numerical Integration: Riemann Sum
From your calculus course, you could recall that, this can be calculated using
the upper Riemann sum and lower Riemann sum where the former fills the
area with larger rectangles and the latter with smaller rectangles.
8
Numerical Integration
• In your real analysis or basic calculus course, you should have explored a
variety of integration and computed them exactly, but they are only
limited.
• In practice, it is not possible to compute all integration analytically.
• Also, when the measurements are known only at discrete points, it is not
possible to obtain the integration. Numerical integration technique could
approximate the values.
• Numerical integration is classified as Newton-Cotes formulas, Romberg
Integration, Quadrature rules.
9
Numerical Integration-
Newton-Cotes
10
Newton-Cotes
• Newton-Cotes formula is further divided into closed forms and open
forms.
• In the closed forms, it considers the end points of the closed interval
[a, b], whereas open form does not.
• The idea is once again to use Weierstrass approximation theorem.
• From real analysis course, we know that if the function is continuous, it is
integrable.
• By Weierstrass approximation theorem, each continuous function is
approximated by a polynomial of degree n.
• Since integrating the polynomial is an easier job compare to an arbitrary
continuous function f (x), Newton-Cotes formula exploits it.
11
Newton-Cotes
• Suppose f ∈ C[a, b], then there exists a polynomial Pn (x) such that
|f − Pn | < ϵ
• The corresponding integration is given by
b b
I= f (x)dx ∼
= Pn (x)dx
a a
• Instead of using a single polynomial, when different polynomials are
used at each of the ith interval, it is termed as composite rule.
b n xi
f (x)dx ∼
X
I= = Pni (x)dx
a i=1 xi−1
13
Basic Trapezoidal Rule
The trapezoidal rule is the first of the Newton-Cotes closed integration
formulas. It corresponds to the case where the polynomial is P1 (x). When
(a, f (a)) and (b, f (b)) are two given points, then the line joining these two
points are given by
y − (f (a) x−a
=
f (b) − f (a) b−a
x−a
y = f (a) + (f (b) − f (a))
b−a
Therefore, the polynomial is given by
x−a
P1 (x) = f (a) + (f (b) − f (a)) (2)
b−a
14
Basic Trapezoidal Rule
Therefore, the integration is given by
b b
I= f (x)dx = P1 (x)dx
a a
b
x−a
= f (a) + (f (b) − f (a))dx
a b−a
b
(x − a)2
= f (a)[x]ba + (f (b) − f (a))
2(b − a) a
1
= f (a)(b − a) + [f (b) − f (a)](b − a)
2
f (b) f (a)
= (b − a) f (a) + −
2 2
f (a) + f (b)
= (b − a)
2 15
Basic Trapezoidal Rule
The equation
f (a) + f (b)
I = (b − a) (3)
2
is called the trapezoidal rule. It is equivalent to approximating the area of the
trapezoid under the line joining (a, f (a)) and (b, f (b)). From school
mathematics, we know that finding the area of trapezoid is the product of the
height and the average of the bases, here the bases are f (a) and f (b) and the
height is (b − a), that is
16
Basic Trapezoidal Rule
f (x0 ) + f (x1 )
I = (x1 − x0 ) (4)
2
18
Examples: Trapezoidal
Rule
19
Examples: Trapezoidal Rule
Example 1
Evaluate 1
2
e−x dx
0
using trapezoidal rule.
20
Examples: Trapezoidal Rule
Example 2
2
0+4
x2 dx = (2 − 0) =4
0 2
2
0 + 24
x4 dx = (2 − 0) = 16
0 2
2
1 1 + 0.3333
dx = (2 − 0) = 1.333
0 1 + x 2
2p √
1+ 5
1 + x2 dx = (2 − 0) = 3.236
0 2
2
1 + e2
ex dx = (2 − 0) = 8.389
0 2
21
Basic Simpson’s 1/3
Rule
22
Basic Simpson’s 1/3 Rule
For Simpson’s 1/3 rule is obtained by applying the second-order interpolating
polynomials.
b b
I= f (x)dx ∼
= P2 (x)dx
a a
Let us consider the following points to obtain the interpolating polynomial
x0 = a, x1 = a+b
2 , x2 = b. Then, the second order Lagrange polynomial P2 (x)
is given by
(x − x1 ) (x − x2 ) (x − x0 ) (x − x2 ) (x − x0 ) (x − x1 )
P2 (x) = f (x0 )+ f (x1 )+ f (x2 )
(x0 − x1 ) (x0 − x2 ) (x1 − x0 ) (x1 − x2 ) (x2 − x0 ) (x2 − x1 )
23
Basic Simpson’s 1/3 Rule
Therefore,
b b
I= f (x)dx ∼
= P2 (x)dx
a x2 a
x2
(x − x1 ) (x − x2 ) (x − x0 ) (x − x2 )
= f (x0 )dx + f (x1 )dx
x0 (x0 − x1 ) (x0 − x2 ) x0 (x1 − x0 ) (x1 − x2 )
x2
(x − x0 ) (x − x1 )
+ f (x2 )dx
x0 (x2 − x0 ) (x2 − x1 )
= Af (x0 ) + Bf (x1 ) + Cf (x2 )
a+b
= Af (a) + Bf ( ) + Cf (b)
2
24
Basic Simpson’s 1/3 Rule
Upon simplication, the values of A, B and C are obtained as follows
b−a a+b
I= [f (a) + 4f + f (b)] (5)
6 2
or
x2 − x0
I= [f (x0 ) + 4f (x1 ) + f (x2 )] (6)
6
Here, the width is (b − a) and the average height is
25
Basic Simpson’s 1/3 Rule
If we denote
b−a x2 − x0
h= = ,
2 2
then we obtain that
h a+b h
I = [f (a) + 4f + f (b)] = [f (x0 ) + 4f (x1 ) + f (x2 )] (7)
3 2 3
26
Thanks
Doubts and Suggestions
panch.m@iittp.ac.in
27
MA206L-Numerical Methods
Lecture 16: Numerical Integration
Panchatcharam Mariappan1
1 Associate Professor
27