Anda di halaman 1dari 7

MDB3053 NUMERICAL METHODS

TUTORIAL 2 – Suggested Solution by Dr. W Pao

1. You are designing a spherical tank (shown below) to hold water for a small village. The volume
of liquid it can hold can be computed as follows:

3V   h2  3R  h 

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? Solve the problem
using Newton-Raphson method and determine the approximate relative error after each
iteration until your error is less than 0.1%.

Ans:
(a) Given R=3, V=30, therefore 30   h2  9  h  . Rewrite equation and divide by pi gives

30
f ( h)  h 3  9h 2  0

f '(h)  3h2  18h

f ( xi )
Recall NR method xi 1  xi 
f '( xi )

This question is a bit tricky as it contains 3 solutions. If the initial guess is very close to 0,
one gets negative h = -1.64081, which is not physical. A better guess is h=3, using the radius as
an initial guess. In this case, h = 2.026906. A third solution is h=8.613907 and this can be
obtained by initial guess of 4 or 5.
Six iteration is good enough to get a good converged solution.

ITER xi f(xi) f'(xi) xi+1 Error


1 3 -25.3521 27 3.938967 23.8379
2 3.938967 -49.8764 -24.355 1.891079 108.2921
3 1.891079 3.225122 -23.3109 2.029431 6.817311
4 2.029431 -0.06103 -24.174 2.026906 0.124557
5 2.026906 -1.9E-05 -24.1593 2.026906 3.79E-05
6 2.026906 -1.7E-12 -24.1593 2.026906 3.51E-12

Attempt all tutorial questions before coming to tutorial session. The session is not for you to do your
exercise but to solve problems you encountered.
MDB3053 NUMERICAL METHODS
TUTORIAL 2 – Suggested Solution by Dr. W Pao

ITER xi f(xi) f'(xi) xi+1 Error


1 5.5 -77.2271 8.25 14.86086 62.99003
2 14.86086 1322.991 395.0401 11.51186 29.09178
3 11.51186 361.5264 190.3551 9.612637 19.75754
4 9.612637 85.25723 104.1809 8.794279 9.305569
5 8.794279 12.73757 73.72101 8.621498 2.004069
6 8.621498 0.513775 67.80373 8.613921 0.087967
7 8.613921 0.000968 67.54833 8.613907 0.000166
8 8.613907 3.46E-09 67.54784 8.613907 5.94E-10

2. A mass balance for a pollutant in a well-mixed lake can be written as


dc
V  W  Qc  kV c
dt
Given V=1x106 m3, Q=1x105 m3/yr, W=1 x 106 g/yr, k = 0.25. Use the Secant method to
solve for the steady-state concentration. What is the best initial guess?

Ans:
At steady state, W  Qc  kV c  0 . Substitute in the values given

1106  1105 c  0.25(1106 ) c  0

Dividing throughout by 1x106, f (c)  1  0.1c  0.25 c  0 .

f  xi  xi 1  xi 
Recall Secant formula xi 1  xi  . To start, when c = 0, f(c) =1. Use this as
f ( xi 1 )  f ( xi )
initial guess.

ITER Xi-1 Xi f(xi-1) f(xi) Xi-1 - Xi Xi+1 Error


0 1.1 1 0.627798 0.65 0.1 3.927636
1 1 3.927636 0.65 0.11178 -2.92764 4.53566 15.48064
2 3.927636 4.53566 0.11178 0.014007 -0.60802 4.622764 1.920444
3 4.53566 4.622764 0.014007 0.000208 -0.0871 4.624079 0.02843
4 4.622764 4.624079 0.000208 3.69E-07 -0.00131 4.624081 5.04E-05
5 4.624079 4.624081 3.69E-07 9.65E-12 -2.3E-06 4.624081 1.32E-09
6 4.624081 4.624081 9.65E-12 0 -6.1E-11 4.624081 0

Attempt all tutorial questions before coming to tutorial session. The session is not for you to do your
exercise but to solve problems you encountered.
MDB3053 NUMERICAL METHODS
TUTORIAL 2 – Suggested Solution by Dr. W Pao

3. Given

f ( x)  2 x6  1.6 x 4  12 x  1

Use bisection to determine the maximum of this function. Employ initial guesses of XL=0,
and XU=1, and perform the iteration until the approximate relative error falls below 5%.

Ans:
Maximum of function of f(x) is when df(x)/dx = 0.
df ( x)
 0  12 x5  6.4 x3  12
dx
Using the algorithm for bisection, we can construct the following table:

ITER XL XU XR f(XL) f(XU) f(XL)*f(XR) f(Xr) Error


1 0 1 0.5 12.0000 -6.4000 129.9 10.8250
2 0.5 1 0.75 10.8250 -6.4000 69.8466211 6.4523 50
3 0.75 1 0.875 6.4523 -6.4000 10.050124 1.5576 16.66667
4 0.875 1 0.9375 1.5576 -6.4000 -3.05879245 -1.9638 7.142857
5 0.875 0.9375 0.90625 1.5576 -1.9638 -0.15394478 -0.0988 3.333333
6 0.875 0.90625 0.890625 1.5576 -0.0988 1.17482023 0.7543 1.724138
7 0.890625 0.90625 0.898438 0.7543 -0.0988 0.25197658 0.3341 0.877193
8 0.898438 0.90625 0.902344 0.3341 -0.0988 0.03983136 0.1192 0.434783
9 0.902344 0.90625 0.904297 0.1192 -0.0988 0.00126404 0.0106 0.21645
10 0.904297 0.90625 0.905273 0.0106 -0.0988 -0.00046664 -0.0440 0.107991
11 0.904297 0.905273 0.904785 0.0106 -0.0440 -0.00017685 -0.0167 0.053937
12 0.904297 0.904785 0.904541 0.0106 -0.0167 -3.216E-05 -0.0030 0.026983

If one continues the iteration, the final answer will be xr = 0.90449.

4. The velocity of a falling parachutist is given by

gm   ct  
v  1  exp    
c   m 

where g = 9.8 m/s2. (a) For a parachutist with a drag coefficient c=15 kg/s, compute the mass
m so that the velocity v=35 m/s at t= 9 s. Use false-position method to determine m to a level
of error below 0.1%. Use initial guess of 10 and 50.

Attempt all tutorial questions before coming to tutorial session. The session is not for you to do your
exercise but to solve problems you encountered.
MDB3053 NUMERICAL METHODS
TUTORIAL 2 – Suggested Solution by Dr. W Pao

(b) Use bisection to determine the drag coefficient needed so that an 80-kg parachutist has a
velocity of 36 m/s after 4 s of free fall. Use intial guesses of XL=0.1 and XU=50, and iterate
until the approximate relative error falls below 2%.

Ans:
(a) Substitute known values into formula
  135  
f (m)  0  0.6533m 1  exp      35
  m 

ITER XL XU F(XL) F(XU) XL-XU F(XL)*F(XU) Xr F(Xr) Error (%)


1 10.0000 50.0000 -28.4670 -4.5303 -40.0000 128.9632 57.5704 -0.9943
2 57.5704 50.0000 -0.9943 -4.5303 7.5704 4.5045 59.6992 -0.0629 3.6977
3 59.6992 50.0000 -0.0629 -4.5303 9.6992 0.2850 59.8358 -0.0041 0.2288
4 59.8358 50.0000 -0.0041 -4.5303 9.8358 0.0184 59.8446 -0.0003 0.0147
5 59.8446 50.0000 -0.0003 -4.5303 9.8446 0.0012 59.8452 0.0000 0.0010

Value of mass, m = 59.8452 kg.

(b)
784   c 
F (c )  0   1  exp      36
c   20  

Attempt all tutorial questions before coming to tutorial session. The session is not for you to do your
exercise but to solve problems you encountered.
MDB3053 NUMERICAL METHODS
TUTORIAL 2 – Suggested Solution by Dr. W Pao

ITER XL XU F(XL) F(XU) F(XL)*F(Xr) Xr F(Xr) Error (%)


0 0.1000 50.0000 3.1022 -21.6071 -42.3354 25.0500 -13.6471
1 0.1000 25.0500 3.1022 -13.6471 -21.4066 12.5750 -6.9005 49.8004
2 0.1000 12.5750 3.1022 -6.9005 -7.4563 6.3375 -2.4036 49.6024
3 0.1000 6.3375 3.1022 -2.4036 0.6460 3.2188 0.2082 49.2110
4 3.2188 6.3375 0.2082 -2.4036 -0.2355 4.7781 -1.1309 48.4466
5 3.2188 4.7781 0.2082 -1.1309 -0.0979 3.9984 -0.4699 16.3179
6 3.2188 3.9984 0.2082 -0.4699 -0.0277 3.6086 -0.1330 9.7499
7 3.2188 3.6086 0.2082 -0.1330 0.0077 3.4137 0.0371 5.4016
8 3.4137 3.6086 0.0371 -0.1330 -0.0018 3.5111 -0.0481 2.8550
9 3.4137 3.5111 0.0371 -0.0481 -0.0002 3.4624 -0.0055 1.3879
10 3.4137 3.4624 0.0371 -0.0055 0.0006 3.4380 0.0158 0.7037
11 3.4380 3.4624 0.0158 -0.0055 0.0001 3.4502 0.0051 0.3543
12 3.4502 3.4624 0.0051 -0.0055 0.0000 3.4563 -0.0002 0.1765
13 3.4502 3.4563 0.0051 -0.0002 0.0000 3.4533 0.0025 0.0881
14 3.4533 3.4563 0.0025 -0.0002 0.0000 3.4548 0.0011 0.0441
15 3.4548 3.4563 0.0011 -0.0002 0.0000 3.4555 0.0005 0.0220
16 3.4555 3.4563 0.0005 -0.0002 0.0000 3.4559 0.0001 0.0110
17 3.4559 3.4563 0.0001 -0.0002 0.0000 3.4561 0.0000 0.0055
18 3.4559 3.4561 0.0001 0.0000 0.0000 3.4560 0.0000 0.0028
19 3.4560 3.4561 0.0000 0.0000 0.0000 3.4561 0.0000 0.0014
20 3.4560 3.4561 0.0000 0.0000 0.0000 3.4560 0.0000 0.0007

The final converged value C=3.45607

Attempt all tutorial questions before coming to tutorial session. The session is not for you to do your
exercise but to solve problems you encountered.
MDB3053 NUMERICAL METHODS
TUTORIAL 2 – Suggested Solution by Dr. W Pao

5. Determine the real root of x3.5  80 (a) analytically and using MATLAB command, and (b)
with the bisection method to within error = 2.5% and 4 significant figures. Use initial guesses
of 2.0 and 5.0.

ITER XL XU F(XL) F(XU) F(XL)*F(Xr) Xr F(Xr) Error (%)


0 2.00000 5.00000 -68.68629 199.50850 -14.54640 3.50000 0.21178
1 2.00000 3.50000 -68.68629 0.21178 3126.07003 2.75000 -45.51228 21.42857
2 2.75000 3.50000 -45.51228 0.21178 1185.68758 3.12500 -26.05203 13.63636
3 3.12500 3.50000 -26.05203 0.21178 360.75815 3.31250 -13.84760 6.00000
4 3.31250 3.50000 -13.84760 0.21178 97.75927 3.40625 -7.05965 2.83019
5 3.40625 3.50000 -7.05965 0.21178 24.60729 3.45313 -3.48562 1.37615
6 3.45313 3.50000 -3.48562 0.21178 5.75999 3.47656 -1.65250 0.67873
7 3.47656 3.50000 -1.65250 0.21178 1.19686 3.48828 -0.72427 0.33708
8 3.48828 3.50000 -0.72427 0.21178 0.18630 3.49414 -0.25723 0.16797
9 3.49414 3.50000 -0.25723 0.21178 0.00591 3.49707 -0.02297 0.08385
10 3.49707 3.50000 -0.02297 0.21178 -0.00217 3.49854 0.09434 0.04189
11 3.49707 3.49854 -0.02297 0.09434 -0.00082 3.49780 0.03567 0.02094
12 3.49707 3.49780 -0.02297 0.03567 -0.00015 3.49744 0.00635 0.01047
13 3.49707 3.49744 -0.02297 0.00635 0.00019 3.49725 -0.00831 0.00524
14 3.49725 3.49744 -0.00831 0.00635 0.00001 3.49734 -0.00098 0.00262
15 3.49734 3.49744 -0.00098 0.00635 0.00000 3.49739 0.00268 0.00131
16 3.49734 3.49739 -0.00098 0.00268 0.00000 3.49737 0.00085 0.00065
17 3.49734 3.49737 -0.00098 0.00085 0.00000 3.49736 -0.00007 0.00033
18 3.49736 3.49737 -0.00007 0.00085 0.00000 3.49736 0.00039 0.00016
19 3.49736 3.49736 -0.00007 0.00039 0.00000 3.49736 0.00016 0.00008
20 3.49736 3.49736 -0.00007 0.00016 0.00000 3.49736 0.00005 0.00004
21 3.49736 3.49736 -0.00007 0.00005 0.00000 3.49736 -0.00001 0.00002
22 3.49736 3.49736 -0.00001 0.00005 0.00000 3.49736 0.00002 0.00001
23 3.49736 3.49736 -0.00001 0.00002 0.00000 3.49736 0.00001 0.00001
24 3.49736 3.49736 -0.00001 0.00001 0.00000 3.49736 0.00000 0.00000
25 3.49736 3.49736 0.00000 0.00001 0.00000 3.49736 0.00000 0.00000
26 3.49736 3.49736 0.00000 0.00000 0.00000 3.49736 0.00000 0.00000
27 3.49736 3.49736 0.00000 0.00000 0.00000 3.49736 0.00000 0.00000
28 3.49736 3.49736 0.00000 0.00000 0.00000 3.49736 0.00000 0.00000

Attempt all tutorial questions before coming to tutorial session. The session is not for you to do your
exercise but to solve problems you encountered.
MDB3053 NUMERICAL METHODS
TUTORIAL 2 – Suggested Solution by Dr. W Pao

6. Determine the real root of f ( x)  26  85x  91x 2  44 x3  8x 4  x5 (a) graphically using
MATLAB; (b) using false position to determine the root to error below 10-5 %. Use initial
guess of 0.5 and 1.0.

Ans:
Two iteration is required for error to go below 10%. The converged value x = 0.55703

ITER XL XU F(XL) F(XU) XL-XU F(XL)*F(XU) Xr F(Xr) Error (%)


0 0.5 1 -1.21875 5 -0.5 -6.09375 0.59798995 0.750568
1 0.5 0.59799 -1.21875 0.750568 -0.09799 -0.914754 0.56064296 0.070244 6.245421
2 0.5 0.560643 -1.21875 0.070244 -0.06064 -0.08561 0.55733819 0.006103 0.589461
3 0.5 0.557338 -1.21875 0.006103 -0.05734 -0.007438 0.55705249 0.000527 0.051262
4 0.5 0.557052 -1.21875 0.000527 -0.05705 -0.000642 0.55702784 4.54E-05 0.004424
5 0.5 0.557028 -1.21875 4.54E-05 -0.05703 -5.54E-05 0.55702572 3.92E-06 0.000382
6 0.5 0.557026 -1.21875 3.92E-06 -0.05703 -4.78E-06 0.55702553 3.38E-07 3.29E-05
7 0.5 0.557026 -1.21875 3.38E-07 -0.05703 -4.12E-07 0.55702552 2.91E-08 2.84E-06
8 0.5 0.557026 -1.21875 2.91E-08 -0.05703 -3.55E-08 0.55702552 2.51E-09 2.45E-07
9 0.5 0.557026 -1.21875 2.51E-09 -0.05703 -3.06E-09 0.55702552 2.17E-10 2.11E-08
10 0.5 0.557026 -1.21875 2.17E-10 -0.05703 -2.64E-10 0.55702552 1.87E-11 1.82E-09
11 0.5 0.557026 -1.21875 1.87E-11 -0.05703 -2.28E-11 0.55702552 1.61E-12 1.57E-10

Attempt all tutorial questions before coming to tutorial session. The session is not for you to do your
exercise but to solve problems you encountered.

Anda mungkin juga menyukai