Sunteți pe pagina 1din 7

Page 1 / 7

EUROPEAN UNIVERSITY OF LEFKE


FACULTY OF ARCHITECTURE AND ENGINEERING
MATH 302 NUMERICAL METHODS SPRING 08-09 MIDTERM MAKEUP EXAM
Date: 21. 04. 2009 Instructor: Prof. Dr. Hüseyin Oğuz
Duration:09:30-11:30
Student Registration No:___________________
Student Name-Surname:__________________________________
Important Note: Your own scientific calculator is allowable to use during exam with forbidding of its exchange.
Please indicate your solutions in the rear side of your exam paper, if needed use the separate sheet to be given.

1. (25 p) The upward velocity of a rocket is given as a function of time in the following Table:

Time (t), s 0 10 15 20 22.5 30


Velocity (v), m/s 0 227.04 362.78 517.35 602.97 901.67

Determine the value of the velocity at t = 16 seconds using second order polynomial interpolation using
Newton’s divided difference polynomial method.

2.(25 p) Solve the following system of equations by LU decomposition without pivoting

8 x1 + 4 x 2 − x3 = 11
− 2 x1 + 5 x 2 + x3 = 4
2 x1 − x 2 + 6 x3 = 7

3.(25 p) Use the Gauss-Seidel method without relaxation to solve the following system to a tolerance of ε s = 5% . If
necessary, rearrange the equations to achieve convergence:
− 3 x1 + x 2 + 12 x3 = 50
6 x1 − x 2 − x3 = 3
6 x1 + 9 x 2 + x3 = 40

4.(25 p) You are working for a start-up computer assembly company and have been asked to determine the
minimum number of computers that the shop will have to sell to make a profit. The equation that gives the
minimum number of computers ‘n’ to be sold after considering the total costs and the total sales is:
f(n) = 40n1.5 − 875n + 35000 = 0
Use the bisection method of finding roots of equations to find
a) The minimum number of computers that need to be sold to make a profit. Conduct three iterations to
estimate the root of the above equation.
b) Find the absolute relative approximate error at the end of each iteration.

Recall for General form of Newton’s Interpolating Polynomials:


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

Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 MT Makeup


Page 2 / 7
MATH 302 NUMERICAL METHODS SPRING 08-09 MIDTERM MAKEUP EXAM SOLUTIONS
Date: 21. 04. 2009 Instructor: Prof. Dr. Hüseyin Oğuz

1)From: http://numericalmethods.eng.usf.edu/
For quadratic interpolation, the velocity is given by
f 2 ( x) = v(t ) = b1 + b2 (t − t1 ) + b3 (t − t1 )(t − t 2 )
Since we want to find the velocity at t = 16, we need to choose the three data points that are closest to
t = 16 and that also bracket t = 16 . These three points are t1 = 10, t 2 = 15, and t 3 = 20 .
t1 = 10, v(t1 ) = 227.04 ,
t 2 = 15, v(t 2 ) = 362.78 ,
t 3 = 20, v(t 3 ) = 517.35 ,
then
b1 = v(t1 )
= 227.04
v(t ) − v(t1 )
b2 = 2
t 2 − t1
362.78 − 227.04
=
15 − 10
= 27.148
v(t 3 ) − v(t 2 ) v(t 2 ) − v(t1 )

t3 − t 2 t 2 − t1
b3 =
t 3 − t1
517.35 − 362.78 362.78 − 227.04

= 20 − 15 15 − 10
20 − 10
30.914 − 27.148
=
10
= 0.37660
Then
f 2 ( x) = v(t ) = b1 + b2 (t − t1 ) + b3 (t − t1 )(t − t 2 )
= 227.04 + 27.148(t − 10) + 0.37660(t − 10)(t − 15), 10 ≤ t ≤ 20
At t = 16,
v(16) = 227.04 + 27.148(16 − 10) + 0.37660(16 − 10)(16 − 15)
= 392.19 m/s
If we expand,
v(t ) = 227.04 + 27.148(t − 10) + 0.37660(t − 10)(t − 15), 10 ≤ t ≤ 20
we get
v(t ) = 12.05 + 17.733t + 0.37660t 2 , 10 ≤ t ≤ 20

2. From: Chapra&Canale/Pr.10.3
The coefficient a21 is eliminated by multiplying row 1 by f21 = –2/8 = –0.25 and subtracting the result from
row 2. a31 is eliminated by multiplying row 1 by f31 = 2/8 = 0.25 and subtracting the result from row 3.
The factors f21 and f31 can be stored in a21 and a31.

 8 4 −1 
− 0.25 6 0.75
 0.25 − 2 6.25

Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 MT Makeup


Page 3 / 7
a32 is eliminated by multiplying row 2 by f32 = –2/6 = –0.33333 and subtracting the result from row 3.
The factor f32 can be stored in a32.

 8 4 −1 
− 0.25 6 0.75
 0.25 − 0.33333 6.5 

Therefore, the LU decomposition is

 1 0 0 8 4 − 1 
[L] = − 0.25 1 0 [U ] = 0 6 0.75
 0.25 − 0.33333 1 0 0 6.5 

Forward substitution: [L]{D} = {B}

 1 0 0  d 1  11
− 0.25 1 0  d 2  =  4 
 0.25 − 0.33333 1 d 3   7 

Solving yields d1 = 11, d2 = 6.75, and d3 = 6.5.

Back substitution:

8 4 − 1   x1   11 
0 6 0.75  x 2  = 6.75
0 0 6.5   x3   6.5 

6. 5
x3 = =1
6. 5

6.75 − 0.75(1)
x2 = =1
6

11 − (−1)(1) − 4(1)
x1 = =1
8

3. From Texbook/Chapra&Canale Pr.11.11


The equations should first be rearranged so that they are diagonally dominant,

6 x1 − x 2 − x 3 = 3

6 x1 + 9 x 2 + x 3 = 40

− 3 x1 + x 2 + 12 x 3 = 50

Each can be solved for the unknown on the diagonal as


3 + x 2 + x3
x1 =
6
40 − 6 x1 − x3
x2 =
9
50 + 3 x1 − x 2
x3 =
12
Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 MT Makeup
Page 4 / 7

The first iteration can be implemented as

3+ 0+0
x1 = = 0. 5
6
40 − 6(0.5) − 0
x2 = = 4.11111
9
50 + 3(0.5) − 4.11111
x3 = = 3.949074
12

Second iteration:

3 + 4.11111 + 3.949074
x1 = = 1.843364
6
40 − 6(1.843364) − 3.949074
x2 = = 2.776749
9
50 + 3(1.843364) − 2.776749
x3 = = 4.396112
12

The error estimates can be computed as

1.843364 − 0.5
ε a ,1 = × 100% = 72.88%
1.843364

2.776749 − 4.11111
ε a, 2 = × 100% = 48.05%
2.776749

4.396112 − 3.949074
ε a ,3 = × 100% = 10.17%
4.396112

The remainder of the calculation proceeds until all the errors fall below the stopping criterion of 5%. The
entire computation can be summarized as

iteration unknown value εa maximum εa


1 x1 0.5 100.00%
x2 4.111111 100.00%
x3 3.949074 100.00% 100.00%
2 x1 1.843364 72.88%
x2 2.776749 48.05%
x3 4.396112 10.17% 72.88%
3 x1 1.695477 8.72%
x2 2.82567 1.73%
x3 4.355063 0.94% 8.72%
4 x1 1.696789 0.08%
x2 2.829356 0.13%
x3 4.355084 0.00% 0.13%

Thus, after 4 iterations, the maximum error is 0.13% and we arrive at the result: x1 = 1.696789, x2 =
2.829356 and x3 = 4.355084.

4. From: http://numericalmethods.eng.usf.edu/
Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 MT Makeup
Page 5 / 7
Assuming initial values of n to be n = 50 and n = 100 ,

that is
nl = 50, nu = 100

Check if the function changes sign between nl and nu


f ( nl ) = f (50 ) = 40(50)1.5 − 875(50) + 35000 = 5392.14

f(nu ) = f (100) = 40(100)1.5 − 875(100) + 35000 = −12500


Hence f (nl ) f (nu ) = f (50 ) f (100 ) = (5392.14 )(− 12500 ) < 0

So there is at least one root between nl and nu that is between 50 and 100.

Iteration 1
The estimate of the root is
n + nu
nr = l
2
50 + 100
=
2
= 75
f (n r ) = f (75) = 40(75)1.5 − 875(75) + 35000 = −4.6443 x 10 3

( )
f (nl ) f (nr ) = f (50) f (75) = (5392.14 ) − 4.6442 x 10 3 < 0

Hence the root is bracketed between nl and nu, that is, between 50 and 75. So, the lower and upper limit of
the new bracket are
nl = 50, nu = 75

At this point, the absolute relative approximate error ∈a cannot be calculated, as we do not have a previous
approximation.

Iteration 2
The estimate of the root is
n l + nu
nr =
2
50 + 75
=
2
= 62.5
f (n r ) = f (62.5) = 40(62.5)1.5 − 875(62.5) + 35000 = 76.7354
f (nl ) f (nr ) = f (50 ) f (62.5) = (5392.14 )(76.7354 ) > 0

Hence, the root is bracketed between nr and nu , that is, between 62.5 and 75. So the lower and upper limit
of the new bracket is

Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 MT Makeup


Page 6 / 7
nl = 62.5, nu = 75

The absolute relative approximate error, ∈a at the end of iteration #2 is

n new − n rold
∈a = r
× 100
n rnew

62.5 − 75
= × 100
62.5

= 20%

None of the significant digits are at least correct in the estimated root of
n r = 62.5

as the absolute relative approximate error is greater that 5%.

Iteration 3
n l + nu
nr =
2
62.5 + 75
=
2
= 68.75
f (n r ) = f (68.75) = 40(68.75)1.5 − 875(68.75) + 35000 = −2.3545 x 10 3

( )
f (nl ) f (nr ) = f (62.5) f (68.75) = (76.734 ) − 2.3545 x 10 3 < 0
Hence, the root is bracketed between nl and n r , that is, between 62.5 and 68.75. So the lower and upper
limit of the new bracket is
nl = 62.5, nu = 68.75

The absolute relative approximate error, ∈a at the ends of Iteration#3 is

n new − n rold
∈a = r
× 100
n rnew

68.75 − 62.5
= × 100
68.75

= 9.0909%

Still none of the significant digits are at least correct in the estimated root of the equation, as the absolute
relative approximate error is greater than 5%.

Seven more iterations can be conducted and these iterations are shown in the table below.
Root of f(x)=0 as function of number of iterations for bisection method.

Iteration nl nu nm ∈a % f(nm)

Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 MT Makeup


Page 7 / 7
Iteration nl nu nm ∈a % f(nm)

1 50 100 75 ---------- -4.6442x103

2 50 75 62.5 20 76.7354

3 62.5 75 68.75 9.0909 -2.3545x103

4 62.5 68.75 65.6250 4.7619 -1.1569x103

5 62.5 65.625 64.0625 2.439 -544.6802

6 62.5 64.0625 63.2813 1.2346 -235.1233

7 62.5 63.2813 62.8906 0.6211 -79.4826

8 62.5 62.8906 62.6953 0.3115 -1.4459

9 62.5 62.6953 62.5977 0.1560 37.6267

10 62.5977 62.6953 62.6465 0.0779 18.0859

At the end of 10th iteration,


∈a = 0.0779%

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.0779 < 0.5 × 10 2− m

0.1558 < 10 2− m
log(0.1558) < 2 − m

m < 2 − log(0.1558) = 2.807

So

m = 2.

The number of significant digits at least correct in the estimated root of 62.6465 is 2.

Prof. Dr. Hüseyin Oğuz MATH302 Spring 08-09 MT Makeup

S-ar putea să vă placă și