Title: SE301: Numerical Methods Topic 7 Numerical Integration Lecture 24-27
1 SE301 Numerical MethodsTopic 7
Numerical Integration Lecture 24-27
KFUPM (Term 101) Section 04 Read Chapter 21,
Section 1 Read Chapter 22, Sections 2-3
2Lecture 24Introduction to Numerical Integration
- Definitions
- Upper and Lower Sums
- Trapezoid Method (Newton-Cotes Methods)
- Romberg Method
- Gauss Quadrature
- Examples
3Integration
Indefinite Integrals Indefinite Integrals of a
function are functions that differ from each
other by a constant.
Definite Integrals Definite Integrals are
numbers.
4Fundamental Theorem of Calculus
5The Area Under the Curve
One interpretation of the definite integral is
Integral area under the curve
f(x)
a
b
6Upper and Lower Sums
The interval is divided into subintervals.
f(x)
a
b
7Upper and Lower Sums
f(x)
a
b
8Example
9Example
10Upper and Lower Sums
- Estimates based on Upper and Lower Sums are easy
to obtain for monotonic functions (always
increasing or always decreasing). - For non-monotonic functions, finding maximum and
minimum of the function can be difficult and
other methods can be more attractive.
11Newton-Cotes Methods
- In Newton-Cote Methods, the function is
approximated by a polynomial of order n. - Computing the integral of a polynomial is easy.
12Newton-Cotes Methods
- Trapezoid Method (First Order Polynomials are
used) - Simpson 1/3 Rule (Second Order Polynomials are
used)
13Lecture 25Trapezoid Method
- Derivation-One Interval
- Multiple Application Rule
- Estimating the Error
- Recursive Trapezoid Method
- Read 21.1
14Trapezoid Method
f(x)
15Trapezoid MethodDerivation-One Interval
16Trapezoid Method
f(x)
17Trapezoid MethodMultiple Application Rule
f(x)
x
a
b
18Trapezoid MethodGeneral Formula and Special Case
19Example
Given a tabulated values of the velocity of an
object. Obtain an estimate of the distance
traveled in the interval 0,3.
Time (s) 0.0 1.0 2.0 3.0
Velocity (m/s) 0.0 10 12 14
Distance integral of the velocity
20Example 1
Time (s) 0.0 1.0 2.0 3.0
Velocity (m/s) 0.0 10 12 14
21Error in estimating the integralTheorem
22Estimating the Error For Trapezoid Method
23Example
24Example
x 1.0 1.5 2.0 2.5 3.0
f(x) 2.1 3.2 3.4 2.8 2.7
25Example
x 1.0 1.5 2.0 2.5 3.0
f(x) 2.1 3.2 3.4 2.8 2.7
26Recursive Trapezoid Method
f(x)
27Recursive Trapezoid Method
f(x)
Based on previous estimate
Based on new point
28Recursive Trapezoid Method
f(x)
Based on previous estimate
Based on new points
29Recursive Trapezoid MethodFormulas
30Recursive Trapezoid Method
31Example on Recursive Trapezoid
n h R(n,0)
0 (b-a)?/2 (?/4)sin(0) sin(?/2)0.785398
1 (b-a)/2?/4 R(0,0)/2 (?/4) sin(?/4) 0.948059
2 (b-a)/4?/8 R(1,0)/2 (?/8)sin(?/8)sin(3?/8) 0.987116
3 (b-a)/8?/16 R(2,0)/2 (?/16)sin(?/16)sin(3?/16)sin(5?/16) sin(7?/16) 0.996785
Estimated Error R(3,0) R(2,0) 0.009669
32Advantages of Recursive Trapezoid
- Recursive Trapezoid
- Gives the same answer as the standard Trapezoid
method. - Makes use of the available information to reduce
the computation time. - Useful if the number of iterations is not known
in advance.
33Lecture 26Romberg Method
- Motivation
- Derivation of Romberg Method
- Romberg Method
- Example
- When to stop?
- Read 22.2
34Motivation for Romberg Method
- Trapezoid formula with a sub-interval h gives an
error of the order O(h2). - We can combine two Trapezoid estimates with
intervals h and h/2 to get a better estimate.
35Romberg Method
R(0,0)
R(1,0) R(1,1)
R(2,0) R(2,1) R(2,2)
R(3,0) R(3,1) R(3,2) R(3,3)
First column is obtained using Trapezoid Method
The other elements are obtained using the
Romberg Method
36First Column Recursive Trapezoid Method
37Derivation of Romberg Method
38Romberg Method
R(0,0)
R(1,0) R(1,1)
R(2,0) R(2,1) R(2,2)
R(3,0) R(3,1) R(3,2) R(3,3)
39Property of Romberg Method
R(0,0)
R(1,0) R(1,1)
R(2,0) R(2,1) R(2,2)
R(3,0) R(3,1) R(3,2) R(3,3)
Error Level
40Example
0.5
3/8 1/3
41Example (cont.)
0.5
3/8 1/3
11/32 1/3 1/3
42When do we stop?
43Lecture 27Gauss Quadrature
- Motivation
- General integration formula
- Read 22.3
44Motivation
45General Integration Formula
46Lagrange Interpolation
47Example
- Determine the Gauss Quadrature Formula of
- If the nodes are given as (-1, 0 , 1)
- Solution First we need to find l0(x), l1(x),
l2(x) - Then compute
48Solution
49Using the Gauss Quadrature Formula
50Using the Gauss Quadrature Formula
51Improper Integrals