0% found this document useful (0 votes)
6 views29 pages

Lecture 16

Uploaded by

pranay rekam
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
0% found this document useful (0 votes)
6 views29 pages

Lecture 16

Uploaded by

pranay rekam
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/ 29

MA206L-Numerical Methods

Lecture 16: Numerical Integration

Panchatcharam Mariappan1

1 Associate Professor

Department of Mathematics and Statistics


IIT Tirupati, Tirupati

September 20, 2024


Numerical Integration

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.

Figure 1: Lower Riemann Sum 5


Numerical Integration: Riemann Sum
Each ith rectangle takes the width as xi − xi−1 and height as respectively
Mi = maxxi−1 ≤x≤xi f (x) and mi = minxi−1 ≤x≤xi f (x) for upper and lower
Riemann rectangles. Then the area of each upper Riemann rectangles Ui is
calculated by Ui = Mi (xi − xi−1 ) and the area of each lower Riemann
rectangles Li is calculated by Li = mi (xi − xi−1 ).

Figure 2: Upper Riemann Sum


6
Numerical Integration: Riemann Sum
• According to the Riemann sum, the area A(f ) is bounded between the
total sum of all area of lower Riemann rectangles and upper Riemann
integrals, that is,
Xn n
X
Li ≤ A(f ) ≤ Ui
i=1 i=1
or
n
X n
X
L(Pn , f ) = mi (xi − xi−1 ) ≤ A(f ) ≤ Mi (xi − xi−1 ) = U (Pn , f )
i=1 i=1

• When the partition is made finer and finer or n → ∞, we obtain the


integral as
 b
A(f ) = f (x)dx
a 7
Numerical Integration
• Numerical integration are often referred as quadrature meant to
construct square having the same area as a curvilinear figure. However,
it refers to numerical definite integration nowadays.
• Integration is widely used by engineers to compute the mass, center of
gravity in civil and mechanical engineering, root mean square current in
electrical engineering, total mass of a chemical present in a reactor when
the concentration varies with respect to the location, energy transfer in
food processing engineering and so on.

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

• When a first order polynomial is applied we obtain trapezoidal rule, for


second and third order polynomials respectively we obtain the Simpson’s
1/3 and Simpsons 3/8 rules. 12
Numerical
Integration-Basic
Trapezoidal Rule

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

I = Width × Average Height

16
Basic Trapezoidal Rule

Figure 3: trapezoidal Rule


17
Basic Trapezoidal Rule
All Newton-cotes closed formula can be expressed in the above format with
different average heights. If we represent (x0 , f (x0 )) = (a, f (a)) and
(x1 , f (x1 )) = (b, f (b)), then we can use Lagrange polynomial
x − x1 x − x0
P1 (x) = f (x0 ) + f (x1 )
x0 − x1 x1 − x0
and the trapezoidal rule becomes

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.

a = 0, b = 1, f (a) = 1, f (b) = 0.36878


f (a) + f (b)
I = (b − a) = 0.6839
2

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

f (x0 ) + 4f (x1 ) + f (x2 )


6

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

Due to the fact that h is divided by 3, it is referred as 1/3 rule.

26
Thanks
Doubts and Suggestions
panch.m@iittp.ac.in

27
MA206L-Numerical Methods
Lecture 16: Numerical Integration

Panchatcharam Mariappan1

1 Associate Professor

Department of Mathematics and Statistics


IIT Tirupati, Tirupati

September 20, 2024

27

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy