You are on page 1of 6

Page 1 / 6

EUROPEAN UNIVERSITY OF LEFKE


FACULTY OF ARCHITECTURE AND ENGINEERING
MATH 302 NUMERICAL METHODS SPRING 08-09 RESIT EXAM
Date: 26. 06. 2009 Instructor: Prof. Dr. Hüseyin Oğuz
Duration:2 h
Student Registration No:_______________________________
Student Name-Surname:__________________________________
Important Note: Your own scientific calculator is allowable to use during exam with forbidding of its
exchange. Formula sheet is given on the backside of your exam paper.

1. (25 p) To find the inverse of a number ‘a’, one can use the equation
1
f (c ) = a − =0
c
where c is the inverse of ‘a’.
Use the Newton-Raphson method of finding roots of equations to
a) Find the inverse of 2.5. Conduct three iterations to estimate the root of the above equation.
b) Find the absolute relative approximate error at the end of each iteration, and
c) The number of significant digits at least correct at the end of each iteration

2.(25 p) An investigator has reported the data tabulated below for an experiment to determine the growth rate
of bacteria k (per d), as a function of oxygen concentration c (mg/L). It is known that such data can be
modeled by the following equation:
k c2
k = max 2
cs + c
where cs and kmax are parameters. Use a transformation to linearize this equation. Then use linear regression
to estimate cs and kmax and predict the growth rate at c = 2 mg/L.
Data:
c 0.5 0.8 1.5 2.5 4
k 1.1 2.4 5.3 7.6 8.9

3.(25 p) The velocity v (m/s) of air flowing past a flat surface is measured at several distances y (m) away from the
surface. Determine the shear stress τ (N/m2) at the surface (y = 0),
dv
τ =µ
dy

Assume a value of dynamic viscosity µ.= 1.8x10-5 N.s/m2


y, m 0 0.002 0.006 0.012 0.018 0.024
v, m/s 0 0.287 0.899 1.915 3.048 4.299

4.(25 p) Evaluate the following integral:


4

∫ (1 − x − 4 x )
+ 2 x 5 dx
3

−2

(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) Simpson’s 3/8 rule. For each of the numerical estimates (b)
through (e), determine the percent relative error based on (a).
Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 ResitExam_26-06-09
Page 2 / 6
FORMULA SHEET

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

Lagrange Interpolating Polynomial;


n n x − xj
f n −1 ( x) = ∑ Li ( x) f ( xi ); Li ( x) = ∏
i =1 j =1 xi − x j
j ≠i
n n n

− −
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 ( x0 ) + f ( x1 )
I ≈ (b − a ) ; sin gle Trapezoidal Rule
2
n −1
f ( x 0 ) + 2∑ f ( xi ) + f ( x n )
i =1
I ≈ (b − a ) ; composite Trapezoidal Rule
2n

I≈
h
[ f ( x0 ) + 4 f ( x1 ) + f ( x2 )] = (b − a) f ( x0 ) + 4 f ( x1 ) + f ( x2 ) ; 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 ( x0 ) + 3 f ( x1 ) + 3 f ( x 2 ) + f ( x3 )] = (b − a) f ( x0 ) + 3 f ( x1 ) + 3 f ( x2 ) + f ( x3 ) ; single Simpson' s 3/8 Rule
8 8

3h  n−2 n −3 
I≈  f ( x 0 + 3 ∑ [ f ( xi ) + f ( xi +1 )] + 2 ∑ f ( x j ) + f ( x n ) ; composite Simpson' s 3/8 Rule
8  i =1, 4, 7 j = 3, 6 , 9 

Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 ResitExam_26-06-09


Page 3 / 6
MATH 302 NUMERICAL METHODS SPRING 08-09 RESIT EXAM SOLUTIONS (26. 06. 2009)
1
1. f (c) = a − = 0
c
1
f ′(c ) =
c2

f (c i )
ci +1 = ci −
f ′(c )
1
a−
ci
= ci −
1
ci2
 1 
= ci − ci2  a − 
 ci 
= ci − ci2 a + ci
∴ ci +1 = 2ci − ci2 a

Iteration #1
The estimate of the root is co= 0.5
∴ c1 = 2c0 − c02 a

= 2(0.5) − (0.5) 2 (2.5)


=0.375
The absolute relative approximate error, ∈a at the end of Iteration #1 is
c1 − c 0
∈a = × 100
c1
0.375 − 0.5
= × 100
0.375
= 33.33%
The number of significant digits at least correct is 0, as you need an absolute relative approximate
error of less than 5% for one significant digit to be correct in your result.
Iteration #2
The estimate of the root is
∴ c 2 = 2c1 − c12 a

= 2(0.375) − (0.375) 2 (2.5)


=0.3984
The absolute relative approximate error, ∈a at the end of Iteration #2 is
c 2 − c1
∈a = × 100
c2
0.3984 − 0.375
= × 100
0.3984
= 5.8824%
The number of significant digits at least correct is 0.
Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 ResitExam_26-06-09
Page 4 / 6
Iteration #3
The estimate of the root is
c3 = 2c 2 − c 22 a

= 2(0.3984) − (0.3984) 2 ( 2.5)


=0.3999
The absolute relative approximate error, ∈a at the end of Iteration #3 is
0.3999 − 0.3984
∈a = × 100
0.3999
= 0.3891 %
Hence the number of significant digits at least correct is given by the largest value of ‘m’ for which
∈a <∈s = 0.5 x10 2− m

0.3891 < 0.5 × 10 2− m


0.7782 < 10 2− m
log(0.7782 ) < 2 − m
m < 2 − log(0.7782 ) = 2.1089
So m = 2
The number of significant digits at least correct in the estimated root of 0.3999 is 2.
2. The equation can be linearized by inverting it to yield

1 c 1 1
= s +
k k max c 2 k max

Consequently, a plot of 1/k versus 1/c should yield a straight line with an intercept of 1/kmax and a slope of cs/kmax

c, mg/L k, /d 1/c2 1/k 1/c2×1/k (1/c2)2


0.5 1.1 4.000000 0.909091 3.636364 16.000000
0.8 2.4 1.562500 0.416667 0.651042 2.441406
1.5 5.3 0.444444 0.188679 0.083857 0.197531
2.5 7.6 0.160000 0.131579 0.021053 0.025600
4 8.9 0.062500 0.112360 0.007022 0.003906
Sum → 6.229444 1.758375 4.399338 18.66844

The slope and the intercept can be computed as

5(4.399338) − 6.229444(1.758375)
a1 = = 0.202489
5(18.66844) − (6.229444) 2

1.758375 6.229444
a0 = − 0.202489 = 0.099396
5 5

Therefore, kmax = 1/0.099396 = 10.06074 and cs = 10.06074(0.202489) = 2.037189, and the fit is

10.06074c 2
k=
2.037189 + c 2
The equation can be used to compute

Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 ResitExam_26-06-09


Page 5 / 6

10.06074(2) 2
k= = 6.666
2.037189 + (2) 2
3. The velocity at the surface can be computed by using second order Lagrange polynomial function as

x0 = 0 f(x0) = 0
x1 = 0.002 f(x1) = 0.287
x2 = 0.006 f(x2) = 0.899

The second order Lagrange polynomial passing through (x0 , y0 ), (x1 , y1 ), ( x2 , y2 ) is

f 2 (x ) =
(x − x1 )(x − x2 ) f (x ) + (x − x0 )(x − x2 ) f (x ) + (x − x0 )(x − x1 ) f (x )
(x0 − x1 )(x0 − x2 ) 0 (x1 − x0 )(x1 − x2 ) 1 (x2 − x0 )(x2 − x1 ) 2

Differentiating equation above gives

′ 2 x − ( x1 + x 2 ) 2 x − ( x0 + x 2 ) 2 x − ( x0 + x1 )
f 2 (x ) = f ( x0 ) + f ( x1 ) + f (x )
(x0 − x1 )(x0 − x 2 ) (x1 − x0 )(x1 − x2 ) (x2 − x0 )(x2 − x1 ) 2
2(0) − 0.002 − 0.006 2(0) − 0 − 0.006 2(0) − 0 − 0.002
f ' ( 0) = 0 + 0.287 + 0.899
(0 − 0.002)(0 − 0.006) (0.002 − 0)(0.002 − 0.006) (0.006 − 0)(0.006 − 0.002)
= 0 + 215.25 − 74.9167 = 140.3333
Therefore, the shear stress can be computed as

N ⋅s 1 N
τ = 1.8 × 10 −5 140.3333 = 0.00253 2
m2 s m
4. (a) Analytical solution:

4
4  x2 x6 
∫ (1 − x − 4 x + 2 x ) dx =  x − − x 4 +  = 1104
3 5
−2 2 3  −2

(b) Trapezoidal rule (n = 1):

− 29 + 1789 1104 − 5280


I = (4 − (−2)) = 5280 εt = × 100% = 378.26%
2 1104

(c) Trapezoidal rule (n = 2):

− 29 + 2(−2) + 1789
I = (4 − (−2)) = 2634 ε t = 138.59%
4

Trapezoidal rule (n = 4):

− 29 + 2(1.9375 − 2 + 131.3125) + 1789


I = (4 − (−2)) = 1516.875 ε t = 37.398%
8

(d) Simpson’s 1/3 rule (n = 2):

Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 ResitExam_26-06-09


Page 6 / 6
− 29 + 4(−2) + 1789
I = (4 − (−2)) = 1752 ε t = 58.7%
6

(e) Simpson’s 3/8 rule:

− 29 + 3(1 + 31) + 1789


I = (4 − (−2)) = 1392 ε t = 26.087%
8

Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 ResitExam_26-06-09