You are on page 1of 30

The American University in Cairo

School of Sciences and Engineering

ENGR 3202: Engineering Analysis &


Computation I

INTEGRATION
Unequal Segments
Multiple Integration
Gauss Quadrature

Dr. Mohamed El Zayat


ENGR 3202 m_elzyat@aucegypt.edu
Summer 2019 1
Integration with Unequal
Segments

ENGR 3202 Summer 2019 2


Integration with unequal segments
This often occurs when integrating experimentally derived data.

It is possible to employ the trapezoidal rule for each segment


independently as follows:
f ( x0 ) + f ( x1 ) f ( x1 ) + f ( x2 ) f ( xn−1 ) + f ( xn )
I = h1 + h2 + ... + hn
2 2 2

However higher accuracy is achieved if Simpson’s rules are


employed whenever possible.

Whenever 2 or 3 successive equal segments exist, then employ


Simpson’s 1/3 or 3/8 rule, respectively. Else employ the
trapezoidal rule
Example 1(21.7 Text Book)
Use the trapezoidal rule to numerically integrate the following
data (which was generated from:
𝑓 𝑥 = 0.2 + 25𝑥 − 200 𝑥 2 + 675𝑥 3 − 900𝑥 4 + 400𝑥 5
employing unequal segments) The exact solution is 1.64053334.
Example 1(21.7 Text Book)
Solution
Example 1(21.7 Text Book)
Solution
Example 2(21.8 Text Book)
Re-compute the integral for the data below, but use Simpson’s
rules for those segments where they are appropriate.
Recall, The exact solution is 1.64053334.
Example 2(21.8 Text Book)
Solution
Interval 1 2 3
x 0 0.12 0.22 0.32
Interval 0.12 0.1 0.1
Width
Trapezoidal
Simpson’s 1/3

Interval 4 5 6
x 0.32 0.36 0.40 0.44
Interval 0.04 0.04 0.04
Width
Simpson’s 3/8
Example 2(21.8 Text Book)
Solution
Interval 7 8 9 10
x 0.44 0.54 0.64 0.70 0.8
Interval 0.1 0.1 0.06 0.1
Width
Simpson’s 1/3
Trapezoidal
Trapezoidal
Example 3
• Determine the distance traveled for the
following data:
Example 3
Solution
Multiple Integrals

ENGR 3202 Summer 2019 12


Multiple Integrals
They are widely used in engineering. A simple example would be
to take the double integral of a function over a rectangular area.
b d
I =   f ( x, y )dydx
a c

Recall form calculus that such integrals


can be computed as iterated integrals

b d
 
d b

I =    f ( x, y )dy dx =    f ( x, y )dx dy
ac  ca 

Thus, the integral in one of the dimensions is evaluated first. The result
integration is integrated in the second dimension.
Multiple Integrals
b
d  
d b

I =    f ( x, y )dy dx =    f ( x, y )dx dy
ac  ca 
• Double integration is a twice application of a single numerical
integration method, once in the y-direction and one for the x-direction.
• Any numerical integration method for single integration can be
applied to double integration.
• The same concept may be extended to 3 or more dimensions

N.B.: Double Integration can be used to determine the volume under a


surface. However, in order to compute a volume of a body or a mass of a
body with different densities, triple integration is used
Example 4(21.9 Text Book)
Suppose that the temperature of a rectangular heated plate is
described by the following function:
T ( x, y) = 2 xy + 2 x − x 2 − 2 y 2 + 72
If the plate is 8-m long (x-dimension) and 6-m wide (y
dimension), compute the average temperature.
a. Using multiple trapezoidal rule with n=2 in both dimensions.
b. Using single application of Simpson’s 1/3 rule in both
dimensions.
Example 4(21.9 Text Book)
continued
Example 5
• Determine the average value for the data
shown in the figure using the following
equation:
Example 5
Solution
Gauss Quadrature

ENGR 3202 Summer 2019 19


Integration of Equations
When given an analytic function to integrate, we can generate values at
any point we desire. This can be exploited to yield higher accuracy.
Gauss Quadrature
It can be used to integrate numerically
analytic functions only.

The 2-point quadrature formula employs a


straight line fit similar to the trapezoidal
rule; however, x0 and x1 are chosen so that
the area under the straight line is exactly
equal to the integral of a cubic and simpler
function
Derivation of the Two-point Gauss-
Legendre Formula
I  c0 f ( x0 ) + c1 f ( x1 )
To derive c0 , c1 x0 x1
1
c0 f ( x0 ) + c1 f ( x1 ) =  1dx = 2
−1
1
c0 f ( x0 ) + c1 f ( x1 ) =  xdx = 0
−1
1
2
c0 f ( x0 ) + c1 f ( x1 ) =  x 2 dx =
−1
3
1
c0 f ( x0 ) + c1 f ( x1 ) =  x 3dx = 0
−1
Derivation of the Two-point Gauss-
Legendre Formula continued
c0 + c1 = 2
c0 x0 + c1 x1 = 0
Solving the equations yields:
1 1
2 c0 = c1 = 1, x0 = − , x1 =
c x +c x =
2
0 0
2
1 1
3 3
3
c0 x03 + c1 x13 = 0  1   1 
I  f − + f 
 3  3
If the limits of integration are not -1,1 then a new variable xd is defined by:
x = a0 + a1 xd
a = a0 + a1 (−1) b+a b−a
a0 = , a1 =
b = a0 + a1 (1) 2 2

b+a b−a b−a


x =  +  xd dx =   dxd
 2   2   2 
and the integral is performed for the transformed function
Higher-Point Formulas
I  c0 f ( x0 ) + c1 f ( x1 ) + ..... + cn−1 f ( xn−1 ) , n= number of points
Example 7(22.3 Text Book)
Evaluate the integral of:
𝑓 𝑥 = 0.2 + 25𝑥 − 200 𝑥 2 + 675𝑥 3 − 900𝑥 4 + 400𝑥 5
between x=0 and x=0.8.
Recall, The exact solution is 1.64053334.
Example 7(22.3 Text Book)
Evaluate the integral of:
𝑓 𝑥 = 0.2 + 25𝑥 − 200 𝑥 2 + 675𝑥 3 − 900𝑥 4 + 400𝑥 5
between x=0 and x=0.8. Use 2 pts Gauss Quadrature
Recall, The exact solution is 1.64053334.
Solution:
Example 7(22.4 Text Book)
Use 3-point Gauss-Legendre formula to evaluate the integral of:
𝑓 𝑥 = 0.2 + 25𝑥 − 200 𝑥 2 + 675𝑥 3 − 900𝑥 4 + 400𝑥 5
between x=0 and x=0.8.
Recall, The exact solution is 1.64053334.

Solution:
Example 8
Evaluate the following function using Gauss Quadrature using 2
and 3 points:
Example 8
Solution
Evaluate the following function using Gauss Quadrature using 2
and 3 points:
Example 8
Solution
Evaluate the following function using Gauss Quadrature using 2
and 3 points:
THANKS

ENGR 3202 Summer 2019 30

You might also like