Lecture Notes 5-Numerical Intergration
Lecture Notes 5-Numerical Intergration
MATHEMATICS
in MECHANICAL
ENGINEERING
Lecture notes
Ha Le Nhu Ngoc Thanh, Ph.D.
Chapter 5:
NUMERICAL INTERGATION
Applied Mathematics in
Ph.D. Ha Le Nhu Ngoc Thanh 2 Mechanical Engineering
Introduction of Newton-Cotes Integration Formulas
Trapezoidal’s Rule
Simpson’s Rule
Gauss quadrature
INTRODUCTION
Newton-Cotes formulas
The Newton-Cotes formulas are the most common numerical integration schemes.
b b
I f (x )dx fn (x )dx
a a
where fn (x ) a0 a1x an 1x n 1
an x n
Applied Mathematics in
Ph.D. Ha Le Nhu Ngoc Thanh 3 Mechanical Engineering
Introduction of Newton-Cotes Integration Formulas
Trapezoidal’s Rule
Simpson’s Rule
Gauss quadrature
f (x 0 ) f (x1 ) f (x1 ) f (x 2 ) f (x n 2) f (x n 1 ) f (x n 1 ) f (x n )
h h h h
2 2 2 2
n 1
h
I f (x 0 ) 2 f (x i ) f (x n )
2 i 1
Applied Mathematics in
Ph.D. Ha Le Nhu Ngoc Thanh 5 Mechanical Engineering
Introduction of Newton-Cotes Integration Formulas
Trapezoidal’s Rule
Simpson’s Rule
Gauss quadrature
Applied Mathematics in
Ph.D. Ha Le Nhu Ngoc Thanh 7 Mechanical Engineering
Introduction of Newton-Cotes Integration Formulas
Trapezoidal’s Rule
Simpson’s Rule
Gauss quadrature
Exercises
4
Exercise 1: I x sin xdx
0
Find value of I, with E 0.2 10 2 , and max f (x ) 2
x [0, ]
4
1 x2
Exercise 2: I e dx
0
Find value of I, with n 8
2
Exercise 3: I (8 4 cos x )dx
0
Find value of I , with n 4, and find E
3 x
Exercise 4: I (1 e )dx
0
Find value of I , with n 5, and find E
4 Solve:
3 5
Exercise 5: I (1 x 4x 2x )dx Guide exercise 1: choose n 7
2
Find value of I , with n 6, and find E
Applied Mathematics in
Ph.D. Ha Le Nhu Ngoc Thanh 8 Mechanical Engineering
Introduction of Newton-Cotes Integration Formulas
Trapezoidal’s Rule
Simpson’s Rule
Gauss quadrature
SIMPSON RULE
Simpson’s rule
The trapezoidal rule use first order (straight line through 2 points) to generate a series
trapezoidal to compute an integration.
The Simpson’s rule use second order (parabolic curve) to generate a series trapezoidal to
compute an integration.
b x2 parabolic f2 (x )
I f (x )dx f2 (x )dx f (x )
a x0
where f2 (x ) a 0 a1x a2x 2 , interpolated by second-order
Lagrange polynomial through three points (x 0 , x1, x 2 )
x x1 x x2 x x0 x x2 x x0 x x1
f2 (x ) f x0 f x1 f x2
x0 x1 x 0
x2 x1 x 0 x1 x 2 x 2 x 0 x 2 x1 a x0 x1 b x2
x2 h
I f2 (x )dx f (x 0 ) 4 f (x1 ) f (x 2 ) Simpson x x0 x1 x2
x0 3
b a x2 x 0 f (x ) f (x 0 ) f (x1 ) f (x 2 )
where h ; (Note: one large interval=two small intervals)
2 2
Applied Mathematics in
Ph.D. Ha Le Nhu Ngoc Thanh 9 Mechanical Engineering
Introduction of Newton-Cotes Integration Formulas
Trapezoidal’s Rule
Simpson’s Rule
Gauss quadrature
SIMPSON RULE
Simpson’s rule for multiple points
b a
h , 2n is number of small interval spaces
2n
b x2 x4 x 2n
I f (x )dx f (x )dx f (x )dx f (x )dx
a x0 x2 x 2n 2
h h 2h
f (x 0 ) 4 f (x1 ) f (x 2 ) f (x 2 ) 4 f (x 3 ) f (x 4 )
3 3
h
f (x 2n 2 ) 4 f (x 2n 1) f (x 2n ) n b a 2h
3
h
f (x 0 ) f (x 2n ) 2 f (x 2 ) f (x 4 ) f (x 2n 2) 4 f (x1 ) f (x 3 ) f (x 2n 1 )
3
2n 1 2n 2
h
I f (x 0 ) 4 f (x i ) 2 f (x j ) f (x 2n )
3 i 1,3,5 j 2,4,6
Applied Mathematics in
Ph.D. Ha Le Nhu Ngoc Thanh 10 Mechanical Engineering
Introduction of Newton-Cotes Integration Formulas
Trapezoidal’s Rule
Simpson’s Rule
Gauss quadrature
SIMPSON RULE
Error of Simpson’s rule
5
M b a i xi yi
E , where M max f (4)(x ) y0 y12
0 0 1
4 x a,b
180 2n I
h
3
2 y2 y4 y6 y8 y10 1 1 12 1.00697
4 y1 y3 y5 y7 y9 y11 2 2 12 1.02817
1 x2 1.46266 3 3 12 1.06449
Example 3: I e dx , n intervals are minimum
0 4 4 12 1.11752
4
Find I ? with E 10 , M max f (4)(x ) 76e 5 5 12 1.18959
x [0,1]
Solve: 6 6 12 1.28403
7 7 12 1.40534
x2
a 0, b 1, f (x ) e , M 76e 8 8 12 1.55962
9 9 12 1.75505
M (b a )5 76e(1 0)5 4 76e 104
E 10 n 4 5.17 10 10 12 2.0026
4 4 4
180 2n 180 2n 180 2 11 11 12 2.31701
12 1 2.71828
b a 1
Choose large interval: n 6 small interval: 2n 12 h
2n 12 Applied Mathematics in
Ph.D. Ha Le Nhu Ngoc Thanh 11 Mechanical Engineering
Introduction of Newton-Cotes Integration Formulas
Trapezoidal’s Rule
Simpson’s Rule
Gauss quadrature
SIMPSON RULE
Applied Mathematics in
Ph.D. Ha Le Nhu Ngoc Thanh 12 Mechanical Engineering
Introduction of Newton-Cotes Integration Formulas
Trapezoidal’s Rule
Simpson’s Rule
Gauss quadrature
Exercises
3.2
Exercise 1: I ln x 2 dx
2
Find value of I , with 2n 6, and find E
2
Exercise 2: I (8 4 cos x )dx
0
Find value of I , with n 4, and find E
3 x
Exercise 3: I (1 e )dx
0
Find value of I , with 2n 10, and find E
4
Exercise 4: I (1 x 4x 3 2x 5 )dx
2
Find value of I , with n 6, and find E
Applied Mathematics in
Ph.D. Ha Le Nhu Ngoc Thanh 13 Mechanical Engineering