NumericalMethods FinalExamQ&As
NumericalMethods FinalExamQ&As
1. (25 p) You are designing a spherical tank to hold water for a small village in a developing country. The volume of
liquid it can hold can be computed as:
V = πh 2
[3R − h]
3
where V= volume [m3], h = depth of water in tank [m], and R = the tank radius [m]. If R =3 m, what depth must the
tank be filled to so that it holds 30 m3? Use three (3) Newton-Raphson iterations to determine your answer. Determine
the absolute relative approximate error ε a as percentage after each iteration. For Newton-Raphson method to be used,
an initial guess of R will always converge.
2.(25 p) On average, the surface area A of human beings is related to weight W and height H . Measurements on a
number of individuals of height 180 cm and different weights (kg) give values of A (m2) in the following table:
W (kg) 70 75 77 80 82 84 87 90
2
A (m ) 2.10 2.12 2.15 2.20 2.22 2.23 2.26 2.30
Show that a power law A = αW β fits these data reasonably well. Evaluate the constants α and β , and predict what the
surface area is for a 95 kg person.
3.(25 p) You have to measure the flow rate of water through a small pipe. In order to do it, you place a bucket at the
pipe’s outlet and measure the volume in the bucket as a function of time as tabulated below. Estimate the flow rate
dV
at t = 7 s.
dt
Time, t [s] 0 1 5 8
Volume, V [cm3] 0 1 8 16.4
∫ (1 − e )dx
−2 x
(a) analytically, (b) single application of the trapezoidal rule, (c) composite trapezoidal rule with n =2 and 4,
(d) single application of Simpson’s 1/3 rule, (e) composite Simpson’s 1/3 rule with n = 4, and (f) single
application of Simpson’s 3/8 rule. For each of the numerical estimates (b) through (f), determine the percent
relative error based on (a).
Interpolation:
Newton Interpolating Polynomial;
f n −1 ( x) = b1 + b2 ( x − x1 ) + .... + bn ( x − x1 )( x − x 2 )...( x − x n −1 )
b1 = f ( x1 ); b2 = f [ x 2 , x1 ] ; b3 = f [ x3 , x 2 , x1 ] ;……….; bn −1 = f [ x n −1 , x n − 2 ,...., x1 ] ; bn = f [ x n , x n−1 ,...., x 2 , x1 ]
[
f xi , x j =] f ( xi ) − f (x j )
[
; f xi , x j , x k = ] [
f xi , x j − f x j − x k ] [ ]
xi − x j xi − x k
f [ x n , x n −1 ,........, x 2 ] − f [ x n −1 , x n − 2 ,........, x1 ]
f [x n , x n −1 ,...., x 2 , x1 ] =
x n − x1
− −
n ∑ x i y i − ∑ xi ∑ y i
i =1 i =1 i =1
Regression: y = a 0 + a1 x, a 0 = y − a1 x ; a1 = 2
n
n
n ∑ x − ∑ xi
2
i
i =1 i =1
Newton-Raphson formula:
f ( xi )
xi +1 = xi −
f ′ (x )
i
Integration:
f ( a ) + f (b )
I ≈ (b − a ) ; single Trapezoida l Rule
2
n −1
f ( x 0 ) + 2∑ f ( xi ) + f ( x n )
i =1
I ≈ (b − a ) ; composite Trapezoida l Rule
2n
I ≈
h
[ f ( x 0 ) + 4 f ( x1 ) + f ( x 2 )] = (b − a ) f ( x 0 ) + 4 f ( x1 ) + f ( x 2 ) ; single Simpson' s 1/3 Rule
3 6
n −1 n−2
f ( x0 ) + 4 ∑
i =1, 3, 5
f ( xi ) + 2 ∑ f (x
j = 2, 4,6
j ) + f ( xn )
I ≈ (b − a ) ; composite Simpson' s 1/3 Rule
3n
I ≈
3h
[ f ( x 0 ) + 3 f ( x1 ) + 3 f ( x 2 ) + f ( x3 )] = (b − a ) f ( x 0 ) + 3 f ( x1 ) + 3 f ( x 2 ) + f ( x3 ) ; single Simpson' s 3/8
8 8
3h n−2 n −3
I ≈ f ( x 0 + 3 ∑ [ f ( x i ) + f ( x i +1 ) ] + 2 ∑ f ( x j ) + f ( x n ) ; composite Simpson' s 3/8 Rule
8 i =1, 4 , 7 j = 3, 6 , 9
MATH 302 NUMERICAL METHODS SPRING 08-09 FINAL EXAM SOLUTIONS (10. 06. 2009)
i = 0; h0 = 3 m:
π π
π 3h02 − h03 − 30 π 3(3) 2 − (3) 3 − 30
h1 = h0 − 3 = 3− 3 = 2.061033
2π 3h0 − πh02 2π 3(3) − π (3) 2
h1 − h0 2.061033 − 3
εa = × 100 = × 100 = 45.558%
h1 2.061033
i = 1; h1 = 2.061033 m:
π π
π 3h12 − h13 − 30 π 3(2.061033) 2 − (2.061033) 3 − 30
h2 = h1 − 3 = 2.061033 − 3 = 2.027042
2π 3h1 − πh12 2π 3(2.061033) − π (2.061033) 2
h2 − h1 2.027042 − 2.061033
εa = × 100 = × 100 = 1.667%
h2 2.027042
i = 2; h2 = 2.027042 m:
π π
π 3h22 − h23 − 30 π 3(2.027042) 2 − (2.027042) 3 − 30
h3 = h2 − 3 = 2.027042 − 3 = 2.026906
2π 3h2 − πh22 2π 3(2.027042) − π (2.027042) 2
h2 − h1 2.026906 − 2.027042
εa = × 100 = × 100 = 0.007%
h2 2.026906
Thus, after only three iterations, the root is determined to be 2.026906 with an approximate relative error of 0.007%.
2. The power fit can be linearized by taking its base-10 logarithm (or its natural logarithm) to give
n n n n n n
n ∑ x i y i − ∑ xi ∑ y i n∑ (log Wi )(log Ai ) − ∑ (log Wi )∑ (log Ai )
i =1 i =1 i =1 i =1 i =1 i =1
a1 = 2
= 2
n
n
n n
n ∑ x − ∑ xi 2
i n∑ (log Wi ) 2 − ∑ (log Wi )
i =1 i =1 i =1 i =1
8(5.212023) − (15.241595)(2.73391)
a1 = = 0.3796 = β
8(29.04718) − (15.241595) 2
n n
_ _ ∑ (log A )
i =1
i ∑ (log W )
i =1
i
2.73391 15.241595
a 0 = y − a1 x = − a1 = − (0.3796) = −0.3815
n n 8 8
− 0.3815
α = 10 = 0.4154
A = α (W ) β = 0.4154(W ) 0.3796 = 0.4154(95) 0.3796 = 2.34m 2
3. The flow rate is equal to the derivative of volume with respect to time. One way to handle unequally spaced
data is to fit a Lagrange or Newton interpolating polynomial from the formula sheet to a set of adjacent points that
bracket the time value of t =7 s at which you want to evaluate the derivative (dV/dt). The polynomial can then be
differentiated analytically to yield a formula to estimate the derivative. The three adjacent points to fit a second-
order Lagrange polynomial:
x0 = 1; f(x0) = 1
x1=5; f(x1) = 8
x2 =8; f(x2)=16.4
2 n x − xj
f 2 ( x) = ∑ Li ( x) f ( xi ) = L0 ( x) f ( x0 ) + L1 ( x) f ( x1 ) + L2 ( x) f ( x 2 ); Li ( x) = ∏
i =0 j =0 xi − x j
j ≠i
x − x1 x − x 2 x − x0 x − x 2 x − x0 x − x1
L0 ( x) = ; L1 ( x) = ; L2 ( x) =
x0 − x1 x0 − x 2 x1 − x0 x1 − x 2 x 2 − x0 x 2 − x1
x − x1 x − x 2 x − x0 x − x 2 x − x0 x − x1
f 2 ( x) = f ( x 0 ) + f ( x1 ) + f ( x 2 )
x 0 − x1 x0 − x 2 x1 − x0 x1 − x 2 x 2 − x0 x 2 − x1
∫ (1 − e
−2 x
[
)dx = x + 0.5e − 2 x ]4
0 = 4 + 0.5e − 2( 4 ) − 0 − 0.5e − 2( 0) = 3.500167731
0
b−a 4−0
n =4(number of segments); h= = =1
n 4
n −1
f ( x 0 ) + 2∑ f ( xi ) + f ( x n )
i =1 f ( x0 ) + 2 f ( x1 ) + 2 f ( x 2 ) + 2 f ( x3 ) + f ( x 4 )
I ≈ (b − a) = ( 4 − 0) =
2n 8
f (0) + 2 f (1) + 2 f (2) + 2 f (3) + f (4) 0 + 2(0.86466 + 0.981684 + 0.99752) + 0.999665
I ≈ ( 4 − 0) = ( 4 − 0)
8 8
I ≈ 3.3437
3.500167731 − 3.3437
εt = × 100 = 4.47%
3.500167731
b−a 4−0
h= = = 1.33333
n 3
3h f ( x 0 ) + 3 f ( x1 ) + 3 f ( x 2 ) + f ( x3 )
I ≈ [ f ( x0 ) + 3 f ( x1 ) + 3 f ( x 2 ) + f ( x3 )] = (b − a )
8 8
4 4 4
f ( 0) + 3 f + 3 f 2 + f 3
I ≈ ( 4 − 0) 3 3 3 = (4 − 0) 0 + 3(0.930517 + 0.995172) + 0.999665 = 3.388366
8 8
3.500167731 − 3.388366
εt = × 100 = 3.19%
3.500167731