CalculasI ApproximationOfIntegration
CalculasI ApproximationOfIntegration
integrations
Using LATEX to prepare slides
Nguyen Van Hoi
Written on July 23, 2022
Integrals
• Problem statement
• Back to integral
• Midpoint rule
• Trapezoidal rule
• Simson’rule
• Exercises.
Problem statement
Rb
a f (x)dx is sometimes impossible to compute exactly since
• Sometimes, it is difficult, or even impossible, to find an antiderivative of f
Problem statement
Rb
a f (x)dx is sometimes impossible to compute exactly since
• Sometimes, it is difficult, or even impossible, to find an antiderivative of f
Problem statement
Rb
a f (x)dx is sometimes impossible to compute exactly since
• Sometimes, it is difficult, or even impossible, to find an antiderivative of f
Z 1 Z 1
x2
p
e dx, 1 + x3 dx
0 −1
• f (x) is determined from a scientific experiment. There may be no formula for the
function.
Problem statement
Rb
a f (x)dx is sometimes impossible to compute exactly since
• Sometimes, it is difficult, or even impossible, to find an antiderivative of f
Z 1 Z 1
x2
p
e dx, 1 + x3 dx
0 −1
• f (x) is determined from a scientific experiment. There may be no formula for the
function.
Problem statement
Rb
a f (x)dx is sometimes impossible to compute exactly since
• Sometimes, it is difficult, or even impossible, to find an antiderivative of f
Z 1 Z 1
x2
p
e dx, 1 + x3 dx
0 −1
• f (x) is determined from a scientific experiment. There may be no formula for the
function.
What should we do?
Answer: In both cases, we need to find approximate values of definite integrals, instead.
Back to integral
Recall that,
Z b n
X
f (x)dx = lim f (x∗i )∆x
a n→∞
1
Z b n
X
f (x)dx ≈ Mn = f (x̄i )∆x (1)
a 1
where
xi−1 + xi
x̄i = . (2)
2
Trapezoidal rule
The Trapezoidal Rule results from averaging the left-right approximations i.e.,
Z b n n
1 X X
f (x)dx ≈ Tn = f (xi−1 )∆x + f (xi )∆x
a 2
1 1
n n
1 X X
= f (xi−1 ) + f (xi ) ∆x
2
1 1
1
= f (x0 ) + 2f (x1 ) + 2f (x2 )
2
+ ... + 2f (xn−1 ) + f (xn ) ∆x.
Example
Use the Trapezoidal and Midpoint rule with n = 5 to approximate
Z 2
1
dx.
1 x
With a = 1, b = 2, n = 5, then ∆x = (2 − 1)/5 = 1/5.
Z 2 5
1 X 1
dx ≈ M5 = f (1.1) + f (1.3) + f (1.5) + f (1.7) + f (1.9) ≈ 0.691908,
1 x 5
1
and
Z 2
1 1
dx ≈ L5 = f (1)+2f (1.2)+2f (1.4)+2f (1.6)+2f (1.8)+f (2) ≈ 0.695635.
1 x 2.5
Question: Which method is better?
Error
How to calculus the error of the approximation?
Error
How to calculus the error of the approximation?
Back to the previous example where we do really know what the integral is exactly
Error
How to calculus the error of the approximation?
Back to the previous example where we do really know what the integral is exactly via the
fundamental theorem of calculus:
Error
How to calculus the error of the approximation?
Back to the previous example where we do really know what the integral is exactly via the
fundamental theorem of calculus:
Z 2
1
dx = Inx |21 = 0.693147...
1 x
Error
How to calculus the error of the approximation?
Back to the previous example where we do really know what the integral is exactly via the
fundamental theorem of calculus:
Z 2
1
dx = Inx |21 = 0.693147...
1 x
The error can be defined as
EM = 0.693147... − 0.691908 and ET = 0.693147... − 0.695635.
Error
How to calculus the error of the approximation?
Back to the previous example where we do really know what the integral is exactly via the
fundamental theorem of calculus:
Z 2
1
dx = Inx |21 = 0.693147...
1 x
The error can be defined as
EM = 0.693147... − 0.691908 and ET = 0.693147... − 0.695635.
In general,
Z b Z b
EM = f (x)dx − Mn and ET = f (x)dx − Tn . (3)
a a
Observation