0% found this document useful (0 votes)
23 views42 pages

CalculasI ApproximationOfIntegration

The document discusses different approximation methods for integrals including the midpoint rule and trapezoidal rule. These rules allow approximating integrals when exact computation is impossible. The document provides examples of applying the rules and calculating the error of approximations compared to the exact integral value.
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)
23 views42 pages

CalculasI ApproximationOfIntegration

The document discusses different approximation methods for integrals including the midpoint rule and trapezoidal rule. These rules allow approximating integrals when exact computation is impossible. The document provides examples of applying the rules and calculating the error of approximations compared to the exact integral value.
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/ 42

Approximation of

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

where ∆x = b−a n , and xi belongings to the


subinterval [xi−1 , xi ] with xi = a + ∆x ∗ i.


Back to integral
Recall that,
Z b n
X
f (x)dx = lim f (x∗i )∆x
a n→∞
1

where ∆x = b−a n , and xi belongings to the


subinterval [xi−1 , xi ] with xi = a + ∆x ∗ i.


Use it as an approximation to the integral
Z b n
X
f (x)dx ≈ f (x∗i )∆x
a 1
Back to integral
Recall that,
Z b n
X
f (x)dx = lim f (x∗i )∆x
a n→∞
1

where ∆x = b−a n , and xi belongings to the


subinterval [xi−1 , xi ] with xi = a + ∆x ∗ i.


Use it as an approximation to the integral
Z b n
X
f (x)dx ≈ f (x∗i )∆x
a 1
Back to integral
Recall that,
Z b n
X
f (x)dx = lim f (x∗i )∆x
a n→∞
1

where ∆x = b−a n , and xi belongings to the


subinterval [xi−1 , xi ] with xi = a + ∆x ∗ i.


Use it as an approximation to the integral
Z b n
X
f (x)dx ≈ f (x∗i )∆x
a 1
Midpoint rule
We consider the case where x∗i is chosen to be the midpoint x̄i of the subinterval [xi−1 , xi ].

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

• More accurate approximations when we increase the value of n. But, it needs


memory.
Observation

• More accurate approximations when we increase the value of n. But, it needs


memory.
• The errors in the left and right endpoint approximations are opposite in sign and
appear to decrease by a factor of about 2.
Observation

• More accurate approximations when we increase the value of n. But, it needs


memory.
• The errors in the left and right endpoint approximations are opposite in sign and
appear to decrease by a factor of about 2.
• The Trapezoidal and Midpoint Rules are much more accurate.
Observation

• More accurate approximations when we increase the value of n. But, it needs


memory.
• The errors in the left and right endpoint approximations are opposite in sign and
appear to decrease by a factor of about 2.
• The Trapezoidal and Midpoint Rules are much more accurate.
• The errors in the Trapezoidal and Midpoint Rules are opposite in sign and appear to
decrease by a factor of about 4.
Observation

• More accurate approximations when we increase the value of n. But, it needs


memory.
• The errors in the left and right endpoint approximations are opposite in sign and
appear to decrease by a factor of about 2.
• The Trapezoidal and Midpoint Rules are much more accurate.
• The errors in the Trapezoidal and Midpoint Rules are opposite in sign and appear to
decrease by a factor of about 4.
• The size of the error in the Midpoint Rule is about half the size of the error in the
Trapezoidal Rule.
Error again
Basically, we don’t know what exactly the integral is? So how to calculus the error.
Error again
Basically, we don’t know what exactly the integral is? So how to calculus the error.
Theorem
Suppose for |f ′′ (x)| ≤ K for a ≤ x ≤ b, then

K(b − a)2 K(b − a)2


|EM | ≤ and |ET | ≤ . (4)
24n2 12n2
Example: How large should we take
R 2in1order to guarantee that the Trapezoidal and
Midpoint Rule approximations for 1 x dx are accurate to within 0.00001?
Error again
Basically, we don’t know what exactly the integral is? So how to calculus the error.
Theorem
Suppose for |f ′′ (x)| ≤ K for a ≤ x ≤ b, then

K(b − a)2 K(b − a)2


|EM | ≤ and |ET | ≤ . (4)
24n2 12n2
Example: How large should we take R 2in1order to guarantee that the Trapezoidal and
Midpoint Rule approximations for 1 x dx are accurate to within 0.00001?
Note |f ′′ (x)| ≤ 2, a = 1 and b = 2, so we need to have
2(1)2 2(1)2
|EM | ≤ < 0.00001 and |ET | ≤ < 0.00001. (5)
24n2 12n2
Error again
Basically, we don’t know what exactly the integral is? So how to calculus the error.
Theorem
Suppose for |f ′′ (x)| ≤ K for a ≤ x ≤ b, then

K(b − a)2 K(b − a)2


|EM | ≤ and |ET | ≤ . (4)
24n2 12n2
Example: How large should we take R 2in1order to guarantee that the Trapezoidal and
Midpoint Rule approximations for 1 x dx are accurate to within 0.00001?
Note |f ′′ (x)| ≤ 2, a = 1 and b = 2, so we need to have
2(1)2 2(1)2
|EM | ≤ < 0.00001 and |E T | ≤ < 0.00001. (5)
24n2 12n2
Straightforward computing yields the minimal steps n should be to attain the error
n = 41 and n = 29.
Simpson’s rule: revisiting original idea
Simpson’s rule: revisiting original idea
Area of an element

• It raises a problem to calculus the area as shown


in the Figure on the left.
Area of an element

• It raises a problem to calculus the area as shown


in the Figure on the left.
• The area is covered by the parabola passing
through 3 points:
Area of an element

• It raises a problem to calculus the area as shown


in the Figure on the left.
• The area is covered by the parabola passing
through 3 points:
Area of an element

• It raises a problem to calculus the area as shown


in the Figure on the left.
• The area is covered by the parabola passing
through 3 points: y = Ax2 + Bx + C.

Z h
h
(Ax2 + Bx + C)dx = (y0 + 4y1 + y2 ).
−h 3
Area of an element

• It raises a problem to calculus the area as shown


in the Figure on the left.
• The area is covered by the parabola passing
through 3 points: y = Ax2 + Bx + C.

Z h
h
(Ax2 + Bx + C)dx = (y0 + 4y1 + y2 ).
−h 3
Area of an element

• It raises a problem to calculus the area as shown


in the Figure on the left.
• The area is covered by the parabola passing
through 3 points: y = Ax2 + Bx + C.

Z h
h
(Ax2 + Bx + C)dx = (y0 + 4y1 + y2 ).
−h 3
Therefore,
Z b
∆x  
f (x)dx ≈ Sn = f (a) + 4f (x1 ) + 2f (x2 ) + 4f (x3 ) + ...2f (xn−2 ) + 4f (xn−1 ) + f (b) .
a 3
Error of Simson method
Define the error Z b
ES = f (x)dx − Sn .
a

The following results states that: if |f ( 4)(x)| ≤ K for all a ≤ x ≤ b, then


K(b − a)5
|ES | ≤
180n4 .
Error of Simson method
Define the error Z b
ES = f (x)dx − Sn .
a

The following results states that: if |f ( 4)(x)| ≤ K for all a ≤ x ≤ b, then


K(b − a)5
|ES | ≤
180n4 .
Example: How largeRshould we take in order to guarantee that the Simson’s Rule
2
approximations for 1 1x dx are accurate to within 0.00001?
Error of Simson method
Define the error Z b
ES = f (x)dx − Sn .
a

The following results states that: if |f ( 4)(x)| ≤ K for all a ≤ x ≤ b, then


K(b − a)5
|ES | ≤
180n4 .
Example: How largeRshould we take in order to guarantee that the Simson’s Rule
2
approximations for 1 1x dx are accurate to within 0.00001?
Note |f ′′ (x) = 24/x(5) | ≤ 24, a = 1 and b = 2, so we need to have
K(b − a)5
< 0.00001 → n = 7. (6)
180n4 .
Exercise

Example 7 on page 539 in Jame Stewart.


Exercises 5-6 on page 540 in Jame Stewart.

You might also like