Sie sind auf Seite 1von 11

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Numerical Methods for Chemical Engineers


Chapter 7: Numerical Integration

Saharudin Haron
Page 7 - 1

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Numerical Integration
Integrate means (dictionary): to bring together, to unite or to indicate the total amount. Mathematically, integration is represented by:

I=

f ( x ) dx

where, I = integral the function f(x) with respect to independent variable x evaluated between limits x = a to x = b. f(x) and equivalent to the area under the curve.

Page 7 - 2

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

The Trapezoidal Rule


Trapezoidal rule is equivalent to approximating the area of the trapezoidal

under the straight line connecting f(a) and f(b)

f (a ) + f (b) I = (b a ) 2
width x average height

Page 7 - 3

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Example: Use trapezoidal rule to numerically integrate the function below,

f(x) = 0.2 + 25x 200x2 + 675 x3 900x4 + 400x5 from a = 0 to b = 0.8 The exact value of the integral, analytically determined is 1.640533
Solution: Function values; f(0) = 0.2 and f(0.8) = 0.232

Substituted into trapezoidal rule formula:

f (a ) + f (b) I = (b a ) 2
= 0.8 [(0.2 + 0.232) / 2 ] = 0.1728 Et = 1.640533 0.1728 = 1.467733
t = 89.5%
Page 7 - 4

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

The Multiple-Application Trapezoidal Rule


To improve the accuracy of Trapezoidal Rule, by dividing the integration interval from a to b into a number of segments (n).
n 1 h I = f ( xo ) + 2 f ( xi ) + f ( xn ) 2 i =1

By substituting h = (b - a)/n,
n 1 f ( x ) 2 f ( x ) f ( x ) + + o i n i =1 I = (b a ) 2n ( width ) Averageheight

Page 7 - 5

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Example: Use the two-segment trapezoidal rule to estimate the integral of:

f(x) = 0.2 + 25x 200x2 + 675x3 900x4 + 400x5 from a = 0 and b = 0.8. The true value for the integral is 1.640533
Solution: n = 2, thus, h = (b-a)/n = (0.8-0)/2 = 0.4

f(0) = 0.2 f(0.4) = 2.456 Thus, I = (0.8)

f(0.8) = 0.232

0.2 + 2(2.456) + 0.232 =1.0688 4


where t = 34.9%
Page 7 - 6

Et = 1.640533 1.0688 = 0.57173

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Numerical Integration
assignment in class
The outflow chemical concentration from a completely mixed reactor is measured as
t, min c, mg/m3 0 10 2 20 4 30 6 40 8 60 12 72 16 70 20 50

For an outflow of Q = 12 m3/min, estimate the mass of chemical that exit the reactor from t = 0 to 20 min

Page 7 - 7

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

The Simpsons Rule


Another way to obtain a more accurate estimate of an integral, by using

high-order polynomials to connect the data points.


If there is an extra point midway between f(a) and f(b), the three points can

be connected with a parabola.


The formulas that result from taking the integrals under these polynomials

are called Simpsons rules.


Simpsons 1/3 Rules Simpsons 3/8 Rules

Page 7 - 8

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

The Simpsons 1/3 Rule


Simpsons 1/3 rule, results when a 2nd order Lagrange interpolating

polynomial is substituted into integral equation;

( x x1 )( x x2 ) ( x x0 )( x x1 ) ( x x0 )( x x 2 ) I= f ( x 2 ) dx f ( x1 ) + f ( x0 ) + x ( x2 x0 )( x2 x1 ) ( x1 x0 )( x1 x2 ) ( x0 x1 )( x0 x2 )

x
1

h I [ f ( x0 ) + 4 f ( x1 ) + f ( x2 )] 3

f ( x0 ) + 4 f ( x1 ) + f ( x2 ) I (b a ) 6 width
average height
Page 7 - 9

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

The Multiple-Application Simpsons 1/3 Rule


Simpsons rule can be improved by dividing the integration interval into a

number of segments of equal width;


n1 n2 f (xi ) + 2 f (x j ) + f (xn ) f (x0) + 4 i=1,3,5 j=2,4,6 I (b a) 3 n width

Average Height
Page 7 - 10

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

The Simpsons 3/8 Rule


Simpsons 3/8 rule, results when a 3rd order Lagrange interpolating

polynomial is fit to four points and integrated;

3h I [ f ( x0 ) + 3 f ( x1 ) + 3 f ( x2 ) + f ( x3 )] 8 f ( x0 ) + 3 f ( x1 ) + 3 f ( x2 ) + f ( x3 ) I (b a ) 8 width
average height
Page 7 - 11