Tutorial 2
Tutorial 2
Tutorial 2
1. Determine the roots of f (x) = 12 21x + 18x2 2.75x3 graphically using MATLAB. In
addition, determine the first root of the function with bisection. Use initial guesses of xl = 1
and xu = 0 and a stopping criterion of 1%.
2. Determine the real roots of f (x) = 0.5x2 + 2.5x + 4.5:
(a) Using quadratic formula
(b) Using three iterations of the bisection method to determine the highest roots. Employ
initial guesses of xl = 5 and xu = 10. Compute the estimated error "a and the true error
"t after each iteration.
3. Determine the highest real root of
f (x) = 2x3 11.7x2 + 17.7x 5
(a) Newton-Raphson method (three iterations, x0 = 3)
(b) Secant method (three iterations, x 1 = 3, x0 = 4)
Compute the approximate percent relative errors for your solutions.
Answer:
1. (a) i xl f (xl ) xu f (xu ) xr f (xr ) |"a |
1 1 29.75 0 12 0.5 3.34375
2 0.5 3.34375 0 12 0.25 5.5820313 100.00%
3 0.5 3.34375 0.25 5.5820313 0.375 1.4487305 33.33%
4 0.5 3.34375 0.375 1.4487305 0.4375 0.8630981 14.29%
5 0.4375 0.863098 0.375 1.4487305 -0.40625 0.3136673 7.69%
6 0.4375 0.863098 0.40625 0.3136673 0.421875 0.2694712 3.70%
7 0.42188 0.269471 0.40625 0.3136673 0.414063 0.0234052 1.89%
8 0.42188 0.269471 0.41406 0.0234052 0.417969 0.1227057 0.93%
(b) i. x1 = 1.405125, x2 = 6.405125
ii. iteration xl xu xm "t "a
1 5 10 7.5 -0.1709
2 5 7.5 6.25 0.0242 -0.20
3 6.25 7.5 6.875 0.0734 0.0909
(c) iteration, i xi "a %
0 3
1 5.1333 41.6
2 4.2698
_
-20.2
3 3.7929 -12.6
(d) iteration, i xi "a %
1 3.3265 -20.2
2 3.4813 4.4
3 3.5863 2.9
2022 Page 1 of 1
f- 1711=-12-2171+18712-2.75713
✗1=-1 Xn=0
3 -
4 -0.5 -
0.375 -
0.0235 1.887.7 .
8 -0.421875 -0.41406 -
2 / Ea =
-0.25-1-0.5 ) =/ 00% 6 Eat =
-0.421875-(-0.4062-5)=3.7047 ,
0.25 -0.421875
3 Ea = -
0.375
-
l -
0.25) =
33.33%
-
0.375 ⑦ Eat =
-0.41406-1-0.421875 ) =
1.88770
4 Ea =
-0.4375-1-0.375 ) =
14.286% -0.41406
0.4375
-
5
/ Eat =
-0.40625-1-0.43751=7.6921 ⑧ / Eat =
-0.41798-1-0.41406 ) =
0,9378%
-
0.40625 -0.41798
(a) -0.5712+2.5×+4.5
✗ =
-
b ± ] b. 2-
4ac
Za
= -
( 2. 5) ± / 12.512-41-0.57/4.5 )
21-0.5 )
= -
2.5 ± 3.905125
-1
✗ 1=-1.405125 ✗2=6.405125
2
Et =
6.405125-6.25=0.0242 3 E -1=6.405125-6.875 =
-0.07334
6. 405125 6.405125
Ea =
6.25-7.5 =
-0.2 ④ Ea= 6.875-6.25=0,0909
6.25 6.875
3 a). f 1) =
C713-11.794+17.77)-5
f'l) 679-23.47)
= 17.7
+ j Xi f (Xi) f'(xi) Sa To
O 3 -
3.2 1.5
Xi+ =xi-2713-11.7914+
3 3. 7929 2.9471 15.2627
1.771-5 12.57%
6712-23.47) + 17.7
4.269]
⑤ 9T 3.7929-4.2697 x1007
= =
-12.37%
3.7929
f 11) =
C713-11.794+17.77)-5
7- 1 =
3 Do 4
=
7) f 1c) Error
3 -
3.2
4 6.6