# D.

Keffer, ChE 505 ,University of Tennessee, September, 1999
i
Numerical Techniques for the Evaluation of
Multi-Dimensional Integral Equations
David Keffer
Department of Chemical Engineering
University of Tennessee, Knoxville
September 1999
1. Numerical Derivation of the trapezoidal rule for the 2-D case with constant integration limits 1
2. Numerical Derivation of the trapezoidal rule for the 3-D case with constant integration limits 3
3. Numerical Derivation of the trapezoidal rule for the 2-D case with variable integration limits 5
4. Numerical Derivation of the Simpson’s 1/3 rule for the 2-D case with constant integration limits 7
D. Keffer, ChE 505 ,University of Tennessee, September, 1999
1
1. Numerical Derivation of the trapezoidal rule for the 2-D case with constant integration limits
In Section 4.6 of “Numerical Recipes in Fortran 77”, second edition, you can find a brief discussion of
when to use different types of numerical methods for evaluating multidimensional integrals.
For the purposes of this course, I am going to show you how to extend the one-dimensional integral
evaluation to n-dimensional integral evaluation. This techniques relies upon you have rather simple boundaries to
the integral.
For integrals in one dimension, we could start with something simple like the trapezoidal rule.
1
]
1

¸

+ + ≈

·
n
2 i
i
b
a
) x ( f 2 ) b ( f ) a ( f
2
h
dx ) x ( f (1.1)
Now if we have a 2-D integral we write this as:
∫ ∫ ∫
· ·
xf
xo
xf
xo
yf
yo
D 2
dx ) x ( g dx dy ) y , x ( f I (1.2)
where
1
1
]
1

¸

+ + ≈ ·

·
y
n
2 i
i f o
y
yf
yo
) y , x ( f 2 ) y , x ( f ) y , x ( f
2
h
dy ) y , x ( f ) x ( g (1.3)
Substituting the discretized approximation for g(x) in equation (1.3) into equation (1.2) we have

∫ ∫
1
1
]
1

¸

+ + ≈
·
xf
xo
n
2 i
i f o
y
xf
xo
yf
yo
dx ) y , x ( f 2 ) y , x ( f ) y , x ( f
2
h
dx dy ) y , x ( f
y
(1.4)
Well, we can repeat the application of the trapezoidal rule:
¹
¹
¹
¹
¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
'
¹
1
]
1

¸

+ + +
1
]
1

¸

+ + +
1
]
1

¸

+ +

∑ ∑

· ·
·
·
x
y
y
y
n
2 j
n
2 i
i j f j o j
y
n
2 i
i f f f o f
y
n
2 i
i o f o o o
y
x
D 2
) y , x ( f 2 ) y , x ( f ) y , x ( f
2
h
2
) y , x ( f 2 ) y , x ( f ) y , x ( f
2
h
) y , x ( f 2 ) y , x ( f ) y , x ( f
2
h
2
h
I (1.5)
Now we can simplify this as much as possible,
D. Keffer, ChE 505 ,University of Tennessee, September, 1999
2
[ ] [ ]
¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
'
¹
+ + + +
+ + + +

∑ ∑
∑∑
· ·
· ·
y
x
y x
n
2 i
n
2 j
f j o j i f i o
n
2 i
n
2 j
i j f f o f f o o o
y x
D 2
) y , x ( f ) y , x ( f 2 ) y , x ( f ) y , x ( f 2
) y , x ( f 4 ) y , x ( f ) y , x ( f ) y , x ( f ) y , x ( f
4
h h
I (1.6)
If we add up the number of function evaluations, we can see that we have
y x
n n function evaluations. If
n n n
y x
· · , then we have
2
n function evaluations for a 2-D integral. If we need to evaluate an m-dimensional
integral, then we will have
m
n function evaluations.
D. Keffer, ChE 505 ,University of Tennessee, September, 1999
3
2. Numerical Derivation of the trapezoidal rule for the 3-D case with constant integration limits
Now if we have a 3-D integral we write this as:
∫ ∫ ∫ ∫
· ·
xf
xo
xf
xo
yf
yo
zf
zo
D 3
dx ) x ( h dx dy dz ) z , y , x ( f I (2.1)
where
∫ ∫ ∫
· ·
yf
yo
yf
yo
zf
zo
dy ) y , x ( g dy dz ) z , y , x ( f ) x ( h (2.2)
where

·
zf
zo
dz ) z , y , x ( f ) y , x ( g (2.3)
Using the trapezoidal rule approximation:
1
]
1

¸

+ + ≈ ·

·
z
n
2 i
i f o
z
zf
zo
) z , y , x ( f 2 ) z , y , x ( f ) z , y , x ( f
2
h
dz ) z , y , x ( f ) y , x ( g (2.4)
Substituting the discretized approximation for g(x,y) from equation (2.4) into equation (2.2) we have

∫ ∫
1
]
1

¸

+ + · ·
·
yf
yo
n
2 i
i f o
z
yf
yo
zf
zo
dy ) z , y , x ( f 2 ) z , y , x ( f ) z , y , x ( f
2
h
dy dz ) z , y , x ( f ) x ( h
z
(2.5)
Well, we can repeat the application of the trapezoidal rule:
¹
¹
¹
¹
¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
'
¹
1
]
1

¸

+ + +
1
]
1

¸

+ + +
1
]
1

¸

+ +

∑ ∑

· ·
·
·
y
z
z
z
n
2 j
n
2 i
i j f j o j
z
n
2 i
i f f f o f
z
n
2 i
i o f o o o
z
y
) z , y , x ( f 2 ) z , y , x ( f ) z , y , x ( f
2
h
2
) z , y , x ( f 2 ) z , y , x ( f ) z , y , x ( f
2
h
) z , y , x ( f 2 ) z , y , x ( f ) z , y , x ( f
2
h
2
h
) x ( h (2.6)
Now we can simplify this as much as possible,
[ ] [ ]
¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
'
¹
+ + + +
+ + + +

∑ ∑
∑∑
· ·
· ·
z
y
y z
n
2 i
n
2 j
f j o j i f i o
n
2 j
n
2 i
i j f f o f f o o o
z y
) z , y , x ( f ) z , y , x ( f 2 ) z , y , x ( f ) z , y , x ( f 2
) z , y , x ( f 4 ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f
4
h h
) x ( h (2.7)
D. Keffer, ChE 505 ,University of Tennessee, September, 1999
4
Now we can apply the trapezoidal rule one more time:
[ ] [ ]
[ ] [ ]
[ ] [ ]
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
]
1

¸

¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
'
¹
+ + + +
+ + + +
+
¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
'
¹
+ + + +
+ + + +
+
¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
'
¹
+ + + +
+ + + +
·

∑ ∑
∑∑
∑ ∑
∑∑
∑ ∑
∑∑
·
· ·
· ·
· ·
· ·
· ·
· ·
nx
2 k
n
2 i
n
2 j
f j k o j k i f k i o k
n
2 j
n
2 i
i j k f f k o f k f o k o o k
n
2 i
n
2 j
f j f o j f i f f i o f
n
2 j
n
2 i
i j f f f f o f f f o f o o f
n
2 i
n
2 j
f j o o j o i f o i o o
n
2 j
n
2 i
i j o f f o o f o f o o o o o
3
z y x
D 3
z
y
y
z
z y
y
z
z y
y z
) z , y , x ( f ) z , y , x ( f 2 ) z , y , x ( f ) z , y , x ( f 2
) z , y , x ( f 4 ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f
2
) z , y , x ( f ) z , y , x ( f 2 ) z , y , x ( f ) z , y , x ( f 2
) z , y , x ( f 4 ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f
) z , y , x ( f ) z , y , x ( f 2 ) z , y , x ( f ) z , y , x ( f 2
) z , y , x ( f 4 ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f
2
h h h
I
(2.8)
which if we really are bored ten minutes to five on a Wednesday evening, we can rearrange as:
[ ]
[ ]
[ ]
[ ] [ ]
[ ]
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
]
1

¸

+
¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
'
¹
+ +
+ + +
+
¹
¹
¹
¹
¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
'
¹
+ + + +
+ + + +
+ + +
+
¹
;
¹
¹
'
¹
+ + + +
+ + +
·
∑∑∑
∑∑
∑∑ ∑∑

· · ·
· ·
· · · ·
·
·
·
nx
2 k
n
1 j
n
2 i
i j k
nx
2 k
n
1 j
f j k o j k
nx
2 k
n
2 i
i f k i o k
n
1 j
n
2 i
i j f i j o
nx
2 k
f f k o f k f o k o o k
n
2 j
f j f o j f f j o o j o
n
2 i
i f f i o f i f o i o o
f f f o f f f o f o o f
f f o o f o f o o o o o
3
z y x
D 3
y z
y
z
y
z
y
z
) z , y , x ( f 8
) z , y , x ( f ) z , y , x ( f
) z , y , x ( f ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f
4
) z , y , x ( f ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f
) z , y , x ( f ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f
) z , y , x ( f ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f
2
) z , y , x ( f ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f
) z , y , x ( f ) z , y , x ( f ) z , y , x ( f ) z , y , x ( f
2
h h h
I
(2.9)
This is the explicit form of the trapezoidal rule applied in 3-dimensions, when the limits of integration are
constant.
D. Keffer, ChE 505 ,University of Tennessee, September, 1999
5
3. Numerical Derivation of the trapezoidal rule for the 2-D case with variable integration limits
Now if we have a 2-D integral with variable limits of integration, we write this as:
∫ ∫ ∫
· ·
xf
xo
xf
xo
) x ( yf
) x ( yo
D 2
dx ) x ( g dx dy ) y , x ( f I (3.1)
where
1
]
1

¸

+ + ≈ ·

·
) x ( n
2 i
i f o
y
) x ( yf
) x ( yo
y
)) x ( y , x ( f 2 )) x ( y , x ( f )) x ( y , x ( f
2
h
dy ) y , x ( f ) x ( g (3.2)
The number of y-intervals, ) x ( n
y
, is now a function of x because the size of the y-range of integration is a
function of x. Substituting the discretized approximation for g(x) in equation (3.2) into equation (3.1) we have

∫ ∫
1
]
1

¸

+ + ≈
·
xf
xo
) x ( n
2 i
i f o
y
xf
xo
yf
yo
dx )) x ( y , x ( f 2 )) x ( y , x ( f )) x ( y , x ( f
2
h
dx dy ) y , x ( f
y
(3.3)
Well, we can repeat the application of the trapezoidal rule:
¹
¹
¹
¹
¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
'
¹
1
]
1

¸

+ + +
1
]
1

¸

+ + +
1
]
1

¸

+ +

∑ ∑

· ·
·
·
x
j y
f y
o y
n
2 j
) x ( n
2 i
j i j j f j j o j
y
) x ( n
2 i
f i f f f f f o f
y
) x ( n
2 i
o i o o f o o o o
y
x
D 2
)) x ( y , x ( f 2 )) x ( y , x ( f )) x ( y , x ( f
2
h
2
)) x ( y , x ( f 2 )) x ( y , x ( f )) x ( y , x ( f
2
h
)) x ( y , x ( f 2 )) x ( y , x ( f )) x ( y , x ( f
2
h
2
h
I (3.4)
Now we can simplify this as much as possible,
¹
¹
¹
¹
¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
'
¹
+
1
]
1

¸

+ + + +
+ + +

∑ ∑
∑ ∑ ∑ ∑
· ·
· · · ·
x j y
x x f y o y
n
2 j
) x ( n
2 i
j i j
n
2 j
j f j
n
2 j
j o j
) x ( n
2 i
f i f
) x ( n
2 i
o i o
f f f f o f o f o o o o
y x
D 2
)) x ( y , x ( f 4
)) x ( y , x ( f )) x ( y , x ( f )) x ( y , x ( f )) x ( y , x ( f 2
)) x ( y , x ( f )) x ( y , x ( f )) x ( y , x ( f )) x ( y , x ( f
4
h h
I (3.5)
D. Keffer, ChE 505 ,University of Tennessee, September, 1999
6
Let’s do an example. Let’s integrate cxy ) y , x ( f · over the range 1 x 0 ≤ ≤ and y x 0 ≤ ≤ . Let’s do it
analytically first:
8
c
8
cx
dx
2
cx
dx
2
cxy
dx cxydy dx dy ) y , x ( f I
1
0
4 1
0
3 1
0
x
0
2 1
0
x
0
xf
xo
yf
yo
D 2
· · ·
1
]
1

¸

· · ·
∫ ∫ ∫ ∫ ∫ ∫
(3.6)
Now let’s do it analytically with 1 . 0 h y x · · ∆ · ∆ 2 c ·
i x yo(x) yf(x) ny(x) f(x,yo) f(x,yf) sum(f(x,yj
)
integral(x)
0 0 0 0 0 0 0 0 0
1 0.1 0 0.1 1 0 0.2 0 0.01
2 0.2 0 0.2 2 0 0.4 0.02 0.022
3 0.3 0 0.3 3 0 0.6 0.12 0.042
4 0.4 0 0.4 4 0 0.8 0.36 0.076
5 0.5 0 0.5 5 0 1 0.8 0.13
6 0.6 0 0.6 6 0 1.2 1.5 0.21
7 0.7 0 0.7 7 0 1.4 2.52 0.322
8 0.8 0 0.8 8 0 1.6 3.92 0.472
9 0.9 0 0.9 9 0 1.8 5.76 0.666
10 1 0 1 10 0 2 8.1 0.91
total 0.2405
The numerical solution is 2405 . 0 I
D 2
· compared to the exact solution, 25 . 0 I
D 2
·
D. Keffer, ChE 505 ,University of Tennessee, September, 1999
7
4. Numerical Derivation of the Simpson’s 1/3 rule for the 2-D case with constant integration limits
Now if we have a 2-D integral we write this as:
∫ ∫ ∫
· ·
xf
xo
xf
xo
yf
yo
D 2
dx ) x ( g dx dy ) y , x ( f I (4.1)
where

,
_

¸
¸
+ + + ≈ ·
∑ ∑

·

·
2 n
7 , 5 , 3 i
i
1 n
6 , 4 , 2 i
i f o
y
yf
yo
y y
) y , x ( f 2 ) y , x ( f 4 ) y , x ( f ) y , x ( f
3
h
dy ) y , x ( f ) x ( g (4.2)
Substituting the discretized approximation for g(x) in equation (4.2) into equation (4.1) we have

∑ ∑
∫ ∫

,
_

¸
¸
+ + + ≈

·

·
xf
xo
2 n
7 , 5 , 3 i
i
1 n
6 , 4 , 2 i
i f o
y
xf
xo
yf
yo
dx ) y , x ( f 2 ) y , x ( f 4 ) y , x ( f ) y , x ( f
3
h
dx dy ) y , x ( f
y y
(4.3)
Well, we can repeat the application of the trapezoidal rule:
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
'
¹

,
_

¸
¸
+ + + +

,
_

¸
¸
+ + + +

,
_

¸
¸
+ + + +

,
_

¸
¸
+ + +

∑ ∑ ∑
∑ ∑ ∑
∑ ∑
∑ ∑

·

·

·

·

·

·

·

·

·

·
2 n
7 , 5 , 3 j
2 n
7 , 5 , 3 i
i j
1 n
6 , 4 , 2 i
i j f j o j
y
1 n
6 , 4 , 2 j
2 n
7 , 5 , 3 i
i j
1 n
6 , 4 , 2 i
i j f j o j
y
2 n
7 , 5 , 3 i
i f
1 n
6 , 4 , 2 i
i f f f o f
y
2 n
7 , 5 , 3 i
i o
1 n
6 , 4 , 2 i
i o f o o o
y
x
D 2
x
y y
x
y y
y y
y y
) y , x ( f 2 ) y , x ( f 4 ) y , x ( f ) y , x ( f
3
h
2
) y , x ( f 2 ) y , x ( f 4 ) y , x ( f ) y , x ( f
3
h
4
) y , x ( f 2 ) y , x ( f 4 ) y , x ( f ) y , x ( f
3
h
) y , x ( f 2 ) y , x ( f 4 ) y , x ( f ) y , x ( f
3
h
3
h
I (4.4)
Now we can simplify this as much as possible,
D. Keffer, ChE 505 ,University of Tennessee, September, 1999
8
[ ] [ ]
[ ] [ ]
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
;
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
¹
'
¹
+ +

,
_

¸
¸
+ +

,
_

¸
¸
+ + + +

,
_

¸
¸
+ + + +
+ + +

∑ ∑ ∑ ∑
∑ ∑ ∑ ∑
∑ ∑
∑ ∑

·

·

·

·

·

·

·

·

·

·

·

·
1 n
6 , 4 , 2 j
1 n
6 , 4 , 2 i
i j
2 n
7 , 5 , 3 j
2 n
7 , 5 , 3 i
i j
2 n
7 , 5 , 3 j
1 n
6 , 4 , 2 i
i j
1 n
6 , 4 , 2 j
2 n
7 , 5 , 3 i
i j
1 n
6 , 4 , 2 j
f j o j
1 n
6 , 4 , 2 i
i f i o
2 n
7 , 5 , 3 j
f j o j
2 n
7 , 5 , 3 i
i f i o
f f o f f o o o
y x
D 2
x
y
x
y
x
y
x
y
x
y
x y
) y , x ( f 16 ) y , x ( f 4
) y , x ( f ) y , x ( f 8
) y , x ( f ) y , x ( f ) y , x ( f ) y , x ( f 4
) y , x ( f ) y , x ( f ) y , x ( f ) y , x ( f 2
) y , x ( f ) y , x ( f ) y , x ( f ) y , x ( f
9
h h
I (4.5)

For the purposes of this course. yi )  2  i=2    xf (1. y o ) + f ( x f . we can repeat the application of the trapezoidal rule: ny h y     f ( x o .3) Substituting the discretized approximation for g(x) in equation (1. y i )  i= 2 2      ny  hx  hy   ≈ + f ( x f . y )dy ≈ yo yf (1. second edition. y f ) + 2∑ f ( x. y f ) + 2∑ f ( x o . y o ) + f ( x. y )  ∑ j i  j f  ∑ 2  j o j= 2 i= 2    I2D (1.5) Now we can simplify this as much as possible. Keffer. y f ) + 2∑ f ( x f .6 of “Numerical Recipes in Fortran 77”. y )dydx ≈ ny  hy  f ( x.1) Now if we have a 2-D integral we write this as: I2D = where xo yo ∫ ∫ f ( x. I am going to show you how to extend the one-dimensional integral evaluation to n-dimensional integral evaluation. ChE 505 . y ) + f ( x . you can find a brief discussion of when to use different types of numerical methods for evaluating multidimensional integrals.2) we have xf yf xo yo ∫ ∫ f ( x. For integrals in one dimension. ∫ f ( x)dx ≈ a xf yf b n h  f (a) + f (b) + 2∑ f ( x i )  2 i =2  (1. September. we could start with something simple like the trapezoidal rule. 1999 1.2) g( x ) = ∫ f ( x.4) Well. y i )  2  2  i= 2     ny nx + 2 h y f ( x . y ) + 2 f ( x .3) into equation (1. y o ) + f ( x. Numerical Derivation of the trapezoidal rule for the 2-D case with constant integration limits In Section 4. y o ) + f ( x o . y i ) dx ∫2 i= 2   xo   xf (1. y f ) + 2∑ f ( x.D.University of Tennessee. 1 . y)dydx = ∫ g( x)dx xo ny  hy  f ( x. This techniques relies upon you have rather simple boundaries to the integral.

y i ) + f ( x f . y o ) + f ( x f . If we need to evaluate an m-dimensional integral.D. then we will have n m function evaluations.6) If we add up the number of function evaluations. y i )  hxh y  i =2 j = 2  ≈   ny nx 4   + 2∑ f ( x o . y f ) + 4∑ ∑ f ( x j . 2 .University of Tennessee. September. we can see that we have nxn y function evaluations. 1999 ny nx    f ( x o . Keffer. ChE 505 . y i ) + 2∑ f ( x j . y f )  j= 2  i =2  I2D [ ] [ ] (1. then we have n2 function evaluations for a 2-D integral. y o ) + f ( x j . y f ) + f ( x f . y o ) + f ( x o . If nx = ny = n .

z i )] + 2∑ f ( x. z o ) + f ( x. y j . September. y. z)dzdydx = ∫ h( x )dx xo xf (2. y f . y f . zo ) + f ( x. zi )  i=2   (2. z f ) + 4∑ ∑ f ( x. z)dzdy = h ∫ 2z yo yf nz   f ( x. z f ) + 2∑ f ( x. y j . y j . y. y j . ChE 505 . z f ) + 2∑ f ( x.1) yf zf h( x ) = where yo zo ∫ ∫ f ( x.D. z)dz zo (2. y f . y f . y o . y. y. ny nz   f ( x. y o . z o ) + f ( x. z f ) + 2∑ f ( x. y)dy yo zf yf (2.2) g( x. y j .2) we have yf zf h( x ) = yo zo ∫ ∫ f ( x. y.7) 3 .6) Now we can simplify this as much as possible. z f )  j= 2  i= 2  [ ] (2. z i ) 2  2  i =2   ny   nz + 2 h z ∑ f ( x. Numerical Derivation of the trapezoidal rule for the 3-D case with constant integration limits Now if we have a 3-D integral we write this as: xf yf zf I3D = where xo yo zo ∫ ∫ ∫ f ( x. y o . y.University of Tennessee.3) Using the trapezoidal rule approximation: g( x.4) into equation (2. 1999 2. y. y ) = ∫ f ( x. z o ) + f ( x. y o . y f . z i ) + f ( x. z o ) + f ( x. z o ) + f ( x. y. z f ) + 2∑ f ( x. z)dzdy = ∫ g( x. zo ) + f ( x. z f ) + f ( x. y.5) Well.y) from equation (2. z )dz ≈ zo zf hz 2 nz   f ( x. we can repeat the application of the trapezoidal rule: nz h z     f ( x. y. z i )  h yhz  j= 2 i= 2  h( x ) ≈   ny nz 4   + 2∑ [f ( x. y f . z f ) + 2∑ f ( x. zi ) dy  i= 2   (2. Keffer. y. z o ) + f ( x. y ) = ∫ f ( x.4) Substituting the discretized approximation for g(x. y o . z i )     2 j= 2  i= 2   (2. y o . y j . z i )  i= 2  2    h   nz hy  z   h( x ) ≈ +  f ( x.

z i )] + 2∑ f ( x f .D. y f . September. y j . z o ) + f ( x k . z f )     i= 2 j= 2     ny nz    f ( x k . y f . y f . z i ) j= 2 i= 2       ny nz   + 2∑ [f ( x o . we can rearrange as: I3D   f ( x o . z o ) + f ( x k . z f ) + 4∑ ∑ f ( x f . z i )] + 2∑ f ( x k . z o ) + f ( x o . z f ) + f ( x k . ChE 505 . y j. y o . z o ) + f ( x o . z i )  nx j= 2 i= 2  + 2   ∑  nz ny  k =2   + 2∑ [f ( x k . y o . z f )    nz    ∑ [f ( x o . y o .8) which if we really are bored ten minutes to five on a Wednesday evening. zo ) + f ( x f . z f )]   23   k =2     ny nz nx n z   ∑ ∑ f ( x o . z i ) + f ( x k . y j. z f ) + 4∑ ∑ f ( x k . y o . y f . y o . z f ) + 4∑ ∑ f ( x o . y o . y j . y o . y j . y f . z f ) + f ( x f . y o . z o ) + f ( x o . 1999 Now we can apply the trapezoidal rule one more time: ny nz     f ( x o . z o ) + f ( x f . y j . y f . y f . zo ) + f (x k . Keffer. z f )     ∑ j= 2       h x h yh z   nx =   + ∑ [f ( x k . z f ) + f ( x f . y f . y f . y o . z o ) + f ( x f . z i ) + f ( x o . y j . y j . z o ) + f ( x k . z f ) + f ( x o . z o ) + f ( x f . z o ) + f ( x k . y f . y o . y o . y o . z o ) + f ( x o . z i )]   j=1 i=2 k = 2 i= 2   + 4 nx ny +     ∑ ∑ f (xk . z i ) + f ( x f . y j . z o ) + f ( x f . z f ) + f ( x f . y o . y f . y f . y f . z i )   (2. z i ) + f ( x f . z i )  h x h yh z   j= 2 i= 2   = +  3 ny nz    2    + 2∑ [f ( x f . z i )]     i= 2     ny     + 2 + f ( x o . when the limits of integration are constant. y j . y j . y j . z o ) + f ( x o .University of Tennessee. y j. z o ) + f (x o . y f . y j . y o . y o . y f . z f )   i= 2  j= 2      [ ] I3D [ ] [ ] (2. y j . y j . y f . y o . y f . z o ) + f ( x f . z i ) + f ( x f . 4 . y j . z i ) + f ( x o . z i ) + ∑ ∑ [f ( x k . y o . y j . z o ) + f ( x k . z i ) + f ( x f . z f )      + f ( x f . y f . z i )] + 2∑ f ( x o . z f )     i= 2 j= 2     n y nz        f ( x f . z f ) + f ( x o .9)  k =2 j=1 i=2 [ ] [ ] [ ] This is the explicit form of the trapezoidal rule applied in 3-dimensions. y o . z f )  k = 2 j=1    n y nz nx    + 8∑ ∑ ∑ f ( x k . z i ) + f ( x k . z f ) + f ( x k .

y i ( x o )) + ∑ f ( x f .4) Now we can simplify this as much as possible.1) we have xf yf xo yo ∫ ∫ f ( x. I2D     f ( x o . y)dydx ≈ ny ( x )  hy  f ( x. we write this as: xf yf ( x ) I2D = where xo yo ( x ) ∫ ∫ f ( x.University of Tennessee. y f ( x )) + 2 ∑ f ( x. 1999 3.2) into equation (3. y f ( x j ))  (3. y i ( x j ))  j f j  ∑ 2  j o j j= 2 i= 2    I2D (3. y o ( x f )) + f ( x f . y ( x )) + 2 ∑ f ( x j . ChE 505 . Substituting the discretized approximation for g(x) in equation (3. y o ( x )) + f ( x. y i ( x f ))  + 2  2  i =2     ny ( x j ) nx  + 2 h y f ( x . y o ( x o )) + f ( x o . Numerical Derivation of the trapezoidal rule for the 2-D case with variable integration limits Now if we have a 2-D integral with variable limits of integration. we can repeat the application of the trapezoidal rule: ny ( x o )  h y   f ( x o . y f ( x f ))   ny ( x o ) ny ( x f ) nx nx  hxh y   ≈ + 2 ∑ f ( x o .D. y ( x ))  j i j   j= 2 i= 2   5 . y i ( x )) dx ∫2 i= 2 xo   xf (3. y o ( x o )) + f ( x o .5) 4   i= 2 i= 2 j= 2 j= 2    ny ( x j ) nx + 4∑ ∑ f ( x . y o ( x j )) + ∑ f ( x j . y i ( x ))  2  i= 2  (3. y f ( x f )) + 2 ∑ f ( x f . y i ( x f )) + ∑ f ( x j . y ( x )) + f ( x .2) The number of y-intervals. y)dydx = ∫ g( x)dx xo xf (3. y o ( x f )) + f ( x f .1) yf ( x ) g( x ) = yo ( x ) ∫ f ( x. y f ( x )) + 2 ∑ f ( x. is now a function of x because the size of the y-range of integration is a function of x. y i ( x o ))    i= 2  2     ny ( xf )   hx  h y  ≈ f ( x f . y)dy ≈ ny ( x )  hy  f ( x. y f ( x o )) + f ( x f .3) Well. n y ( x ) . y o ( x )) + f ( x. y f ( x o )) + 2 ∑ f ( x o . September. Keffer.

I2D = 0.21 2.4 0.1 0.8 0.7 0.92 0.022 0.yf) 0 0.91 total 0.076 0.8 2 sum(f(x. y )dydx = ∫ ∫ cxydydx = ∫  dx = ∫  8 2 2 0 xo yo 0 0 0  0 xf yf 1 x 1 x 1 = 0 c 8 (3. y ) = cxy over the range 0 ≤ x ≤ 1 and 0 ≤ x ≤ y . Let’s do it analytically first: I2D 1  cxy 2  cx 4 cx 3 dx = = ∫ ∫ f ( x. Let’s integrate f ( x.2405 compared to the exact solution. 1999 Let’s do an example.13 1.7 0.76 0.6 1.4 1.6 0.1 0.2 0. Keffer.2 0.6 0.2 0.9 1 yo(x) 0 0 0 0 0 0 0 0 0 0 0 yf(x) 0 0.1 0. ChE 505 .8 0.2405 The numerical solution is I2D = 0.1 c = 2 i 0 1 2 3 4 5 6 7 8 9 10 x 0 0.6) Now let’s do it analytically with ∆x = ∆y = h = 0.4 0. September.8 1 1.yo) 0 0 0 0 0 0 0 0 0 0 0 f(x.472 5.666 8.8 0.2 1.4 0.36 0.52 0.042 0.12 0.25 6 .D.322 3.5 0.01 0.yj integral(x) ) 0 0 0 0.9 1 ny(x) 0 1 2 3 4 5 6 7 8 9 10 f(x.5 0.5 0.3 0.University of Tennessee.3 0.6 0.02 0.

5. y i ) + 2 ∑ f ( x. y i )     j=3.5.4) Now we can simplify this as much as possible. y o ) + f ( x. y)dydx ≈ n y −1 n y −2  hy   f ( x.7   (4. Keffer. 4. y f ) + 4 ∑ f ( x.7    I2D (4. y o ) + f ( x j .7 xo   xf (4. yi )     i= 2.7f ( x f . y f ) + 4 ∑ f ( x. 4.5.5. y ) + 4  f o  ∑. September.1) we have xf yf xo yo ∫ ∫ f ( x.D.6 i=3. 7 . y i ) + 2i=∑.6 i=3.5 hx     ≈   n y −1 n y −2 n x −1 3   hy    + 4 ∑ 3  f ( x j . y i )  f f   3  i= 2.7    n y −1 ny −2  n x −2  h  + 2 ∑ y  f ( x j . y i )   3  i= 2. yo ) + f ( xo . y i )   j= 2. y f ) + 4 ∑ f ( x j .5. y i ) dx ∫3  i= 2. y i ) + 2 ∑ f ( x j . y o ) + f ( x.2) Substituting the discretized approximation for g(x) in equation (4. y i ) + 2 ∑ f ( x.5.6 i=3.University of Tennessee.7 3  i= 2. y)dydx = ∫ g( x)dx xo xf (4. 4. y i ) + 2 ∑ f ( x j . y o ) + f ( x j . y f ) + 4 ∑ f ( x j .4 . 4 3. y ) + f ( x . Numerical Derivation of the Simpson’s 1/3 rule for the 2-D case with constant integration limits Now if we have a 2-D integral we write this as: xf yf I2D = where xo yo ∫ ∫ f ( x. yi ) + 2 ∑ f ( xo .3) Well. 4.1) g( x ) = ∫ f ( x.6f ( x f . 6 i= 3. y f ) + 4 ∑ f ( x o.2) into equation (4. ChE 505 . we can repeat the application of the trapezoidal rule: n y −1 ny −2  h y    f (x o .7  3     n y −1 n y −2   + h y  f ( x . y )dy ≈ yo yf n y −2 n y −1  hy   f ( x. 1999 4. 4. 6 i= 3.6 i= 2.

5.7 [ ] [ ] (4. y i ) + 16 ∑ ∑ f ( x j .4. y o ) + f ( x j . y i ) + f ( x f .5) 8 . yi )     j=2. y o ) + f ( x j . y i ) j= 2.7 i=3.University of Tennessee. y f )    9   i=2.4 .5. y f )   ny −2 n x −2  + 2 ∑ [f ( x o . y i )] + ∑ f ( x j . y i )] + ∑ f ( x j . 1999 I2D      f ( x o . 6     n y −2 n y −1 n x −1 nx −2   + 8  ∑ ∑ f (x j . September. ChE 505 . y f ) + f ( x f . yi ) + ∑ ∑ f ( x j.D. 4. 4. y o ) + f ( x o . y f )      i=3.6 j=2.6     n x −2 n y −2 n x −1 n y −1    + 4 ∑ ∑ f ( x j .4.7     n y −1 n x −1  hxh y   ≈ + 4 ∑ [f ( x o . y o ) + f ( x f .7 j= 3.6 i= 2.5.7 i= 2. y i ) + f ( x f .6   j=3. Keffer.6 i=3. 4.5.5.7 j= 3.5.