You are on page 1of 10

STQM 3413 : Kaedah berangka / Numerical methods

Assignment 2 / Tugasan 2 : Penyelesaian persamaan tak linear/Solutions of non-linear


equations.
Due date / Tarikh akhir : 4/11/2020 (10pm)
Semester 1, Session 2020/2021

1. Use fixed-point iteration method to find a fixed-point of p = 0.5 p 3 + 0.3. Take p0 = 0.1
as the initial approximation and compute p1, p2, p3. Round the answer correct to 5
decimal places.

Solution:

p = 0.5 p 3 + 0.3.
pn +1 = G ( pn )

n pn pn +1 = 0.5 pn3 + 0.3


0 p0 = 0.10000 p1 = 0.30050
1 p1 = 0.30050 p2 = 0.31357
2 p2 = 0.31357 p3 = 0.31542

Therefore, p1 = 0.30050 , p2 = 0.31357 and p3 = 0.31542 .

2. The equation x 3 − x − e x − 2 = 0 has a root between x = 2 and x = 3.


a) Write four different iteration functions for solving the equation using the fixed-
point iteration method.
b) Determine which g ( x ) from part (a) could be used according to the condition
in Eq. (3.30).

c) Carry out the first five iterations using the g ( x ) determined in part (b) starting
with x = 2. Round the answer correct to 5 decimal places.

Solution:

a)

1
x 3 − x − e x − 2 = 0, x3 − x − e x − 2 = 0, x 3 − x − e x − 2 = 0, x3 − x − e x − 2 = 0,
− x = − x 3 + e x + 2. x3 = x + e x + 2, x ( x 2 − 1) = e x + 2, −e = − x + x + 2,
x 3

x = x 3 − e x − 2. x = ( x + ex + 2) . e x = x3 − x − 2,
13
ex + 2
x= 2
ln e x = ln ( x3 − x − 2 ) ,
.
g ( x ) = x 3 − e x − 2. x −1
g ( x ) = ( x + e + 2) .
x 13

ex + 2 x = ln ( x3 − x − 2 ) .
g ( x) = 2 .
x −1
g ( x ) = ln ( x3 − x − 2 ) .

b)

g ( x ) = x 3 − e x − 2. g ( x ) = ( x + ex + 2) .
13

g  ( x ) = 3x 2 − e x . 1
(1 + e x )( x + e x + 2 ) .
−2 3
g( x) =
g  ( 2 ) = 4.61  1. 3
g  ( 3) = 6.91  1. g  ( 2 ) = 0.55  1.
Cannot be used. g  ( 3) = 0.82  1.
Can be used.

ex + 2 g ( x ) = ln ( x3 − x − 2 ) .
g ( x) = 2 ,
x −1 3x 2 − 1
e x x 2 − e x − 2 xe x − 4 x g ( x) = .
g( x) = , x3 − x − 2
( )
2
x 2
− 1 g  ( 2 ) = 2.75  1.
g  ( 2 ) = 1.70  1. g  ( 3) = 1.18  1.
g  ( 3) = 0.44  1. Cannot be used.
Cannot be used.

Therefore, g ( x ) = ( x + e x + 2 )
13
can be used.

c)

0 2.00000 2.24990 0.24990


1 2.24990 2.39493 0.14504
2 2.39493 2.48592 0.09098
3 2.48592 2.54572 0.05980
4 2.54572 2.58623 0.04051
5 2.58623 2.61421 0.02799

Therefore, x1 = 2.24990, x2 = 2.39493, x3 = 2.48592, x4 = 2.54572 and x5 = 2.58623.

2
3. Use a fixed-point iteration method to determine a solution accurate to within 10 −4 for
x = tan x, for x in  4,5. Round the answer correct to 4 decimal places. Hint, use
radian.

Solution:

Using g ( x ) = tan x and x0 = 4 yields

g ( x ) = tan x
1
g ( x) = 2
= sec2 x.
cos x
g  ( 4 ) = 2.34  1.
g  ( 5 ) = 12.43  1.

Cannot be used. Hence, we need to find other possibility of x = g ( x ) .


x = tan x
1 1
= ,
x tan x
1 1
− = 0.
tan x x

We know that x = g ( x),


g ( x ) = x + 0,
1 1
g ( x) = x + − .
tan x x
1 1
g( x) = 1− 2
+ 2.
sin x x
g  ( 4 ) = 0.68  1.
g  ( 5 ) = 0.04  1.
Hence, this form can be used as the iterative function.

3
x g'(x)
4 -0.68346
4.1 -0.43399
4.2 -0.25972
4.3 -0.1373
4.4 -0.05265
4.5 0.002882
4.6 0.034521
4.7 0.045116
4.8 0.035688
4.9 0.005609
5 -0.04751

0 4.0000 4.6137 0.6137


1 4.6137 4.4960 0.1177
2 4.4960 4.4934 0.0026
3 4.4934 4.4934 0.0000 <0.0001

Therefore, the solution is 4.4934.

4. Use a fixed-point iteration method to determine a solution accurate to within 10 −2 for


x 3 − x − 1 = 0 on 1, 2. Use x0 = 1. Round the answer correct to 5 decimal places.

Solution:
g ( x ) = ( x + 1) .
13

1
g( x) = ( x + 1) .
−2 3

3
g  (1) = 0.21  1.
g  ( 2 ) = 0.16  1.

0 1.00000 1.25992 0.25992


1 1.25992 1.31229 0.05237
2 1.31229 1.32235 0.01006
3 1.32235 1.32427 0.00191 <0.01

Therefore, the solution is 1.32427

5. Use the bisection method to find x3 for f ( x ) = x − cos x = 0 on  0,1 . Round the
answer correct to 3 decimal places. Hint, use radian.

4
Solution:

0 0.000 1.000 -1.000 0.460 0.500 -0.170


1 0.500 1.000 -0.170 0.460 0.750 0.134
2 0.500 0.750 -0.170 0.134 0.625 -0.020
3 0.625 0.750 -0.020 0.134 0.688 0.056

Therefore, x3 = 0.625.

6. Use the bisection method to find solutions accurate within 10 −2 for


x 3 − 7 x 2 + 14 x − 6 = 0 on each interval
a)  0,1
b) 1,3.2
c) 3.2, 4
Solution:

a)
0 0.0000 1.0000 -6.0000 2.0000 0.5000 -0.6250
1 0.5000 1.0000 -0.6250 2.0000 0.7500 0.9844
2 0.5000 0.7500 -0.6250 0.9844 0.6250 0.2598
3 0.5000 0.6250 -0.6250 0.2598 0.5625 -0.1619
4 0.5625 0.6250 -0.1619 0.2598 0.5938 0.0540
5 0.5625 0.5938 -0.1619 0.0540 0.5781 -0.0526
6 0.5781 0.5938 -0.0526 0.0540 0.5859 0.0010
Since f ( c7 ) = 0.001  0.01, then x = 0.5859.

b)

0 1.0000 3.2000 2.0000 -0.1120 2.1000 1.7910


1 2.1000 3.2000 1.7910 -0.1120 2.6500 0.5521
2 2.6500 3.2000 0.5521 -0.1120 2.9250 0.0858
3 2.9250 3.2000 0.0858 -0.1120 3.0625 -0.0544
4 2.9250 3.0625 0.0858 -0.0544 2.9938 0.0063
5 2.9938 3.0625 0.0063 -0.0544 3.0281 -0.0265
6 2.9938 3.0281 0.0063 -0.0265 3.0109 -0.0107
7 2.9938 3.0109 0.0063 -0.0107 3.0023 -0.0023
Since f ( c8 ) = 0.023  0.01, then x = 3.0023.

c)

5
0 3.2 4 -0.112 2 3.6000 0.3360
1 3.2 3.6 -0.112 0.336 3.4000 -0.0160
2 3.4 3.600 -0.016 0.336 3.5000 0.1250
3 3.400 3.500 -0.016 0.125 3.4500 0.0461
4 3.400 3.450 -0.016 0.046 3.4250 0.0130
5 3.400 3.425 -0.016 0.013 3.4125 -0.0020
6 3.413 3.425 -0.002 0.013 3.4188 0.0054

Since f ( c6 ) = 0.0054  0.01, then x = 3.4188.

7. The function f ( x ) = x5 − 3x3 + 2.5 x − 0.6 has exactly one root in 1, 2. By using the
bisection method, determine the root with an error of at most 10 −5. Round the answer
correct to 6 decimal places.

Solution:

0 1.000000 2.000000 -0.100000 12.400000 1.500000 0.618750


1 1.000000 1.500000 -0.100000 0.618750 1.250000 -0.282617
2 1.250000 1.500000 -0.282617 0.618750 1.375000 -0.046442
3 1.375000 1.500000 -0.046442 0.618750 1.437500 0.220548
4 1.375000 1.437500 -0.046442 0.220548 1.406250 0.072249
5 1.375000 1.406250 -0.046442 0.072249 1.390625 0.009393
6 1.375000 1.390625 -0.046442 0.009393 1.382813 -0.019379
7 1.382813 1.390625 -0.019379 0.009393 1.386719 -0.005209
8 1.386719 1.390625 -0.005209 0.009393 1.388672 0.002038
9 1.386719 1.388672 -0.005209 0.002038 1.387695 -0.001599
10 1.387695 1.388672 -0.001599 0.002038 1.388184 0.000216
11 1.387695 1.388184 -0.001599 0.000216 1.387939 -0.000693
12 1.387939 1.388184 -0.000693 0.000216 1.388062 -0.000239
13 1.388062 1.388184 -0.000239 0.000216 1.388123 -0.000012
14 1.388123 1.388184 -0.000012 0.000216 1.388153 0.000102
15 1.388123 1.388153 -0.000012 0.000102 1.388138 0.000045 0.000015
16 1.388123 1.388138 -0.000012 0.000045 1.388130 0.000017 0.000008
17 1.388123 1.388130 -0.000012 0.000017 1.388126 0.000003 <0.00001
Therefore, x = 1.388126.

8. Use the bisection method to find to four decimal places a root of 0.1x 2 − x ln x = 0
between 1 and 2.

Solution:

6
0 1.0000 2.0000 0.1000 -0.9863 1.5000 -0.3832
1 1.0000 1.5000 0.1000 -0.3832 1.2500 -0.1227
2 1.0000 1.2500 0.1000 -0.1227 1.1250 -0.0059
3 1.0000 1.1250 0.1000 -0.0059 1.0625 0.0485
4 1.0625 1.1250 0.0485 -0.0059 1.0938 0.0216
5 1.0938 1.1250 0.0216 -0.0059 1.1094 0.0079
6 1.1094 1.1250 0.0079 -0.0059 1.1172 0.0010
7 1.1172 1.1250 0.0010 -0.0059 1.1211 -0.0025
8 1.1172 1.1211 0.0010 -0.0025 1.1191 -0.0007
9 1.1172 1.1191 0.0010 -0.0007 1.1182 0.0001
10 1.1182 1.1191 0.0001 -0.0007 1.1187 -0.0003
11 1.1182 1.1187 0.0001 -0.0003 1.1184 -0.0001
12 1.1182 1.1184 0.0001 -0.0001 1.1183 0.0000
13 1.1183 1.1184 0.0000 -0.0001 1.1183 0.0000

Therefore, the solution is 1.1183.

9. Let f ( x ) = − x3 − cos x. With x0 = −1 and x1 = 0 , find x3 using


a) the secant method.
b) The method of false position.
Round the answer correct to 5 decimal places.

Solution:

a)

1 -1.00000 0.00000 0.45970 -1.00000 -0.68507 -0.45285


2 0.00000 -0.68507 -1.00000 -0.45285 -1.25208 1.64952

Therefore, x3 is −1.25208.

b)

1 -1.00000 0.00000 0.45970 -1.00000 -0.68507 -0.45285


2 -1.00000 -0.68507 0.45970 -0.45285 -0.84136 -0.07088

Therefore, x3 is −0.84136.

10. Use the method of false position to find solutions accurate to within 10 −4 for the
following problems:
a) x3 − 2 x 2 − 5 = 0, 1, 4
b) x3 + 3x 2 − 1 = 0,  −3, −2
c) x − cos x = 0,  0,  2
d) x − 0.8 − 0.2sin x = 0, 0,  2
Round the answer correct to 5 decimal places.

7
Solution:

a)

1 1.00000 4.00000 -6.00000 27.00000 1.54545 -6.08565


2 1.54545 4.00000 -6.08565 27.00000 1.99693 -5.01222
3 1.99693 4.00000 -5.01222 27.00000 2.31056 -3.34203
4 2.31056 4.00000 -3.34203 27.00000 2.49664 -1.90432
5 2.49664 4.00000 -1.90432 27.00000 2.59569 -0.98649
6 2.59569 4.00000 -0.98649 27.00000 2.64519 -0.48560
7 2.64519 4.00000 -0.48560 27.00000 2.66912 -0.23300
8 2.66912 4.00000 -0.23300 27.00000 2.68051 -0.11043
9 2.68051 4.00000 -0.11043 27.00000 2.68589 -0.05203
10 2.68589 4.00000 -0.05203 27.00000 2.68841 -0.02444
11 2.68841 4.00000 -0.02444 27.00000 2.68960 -0.01147
12 2.68960 4.00000 -0.01147 27.00000 2.69016 -0.00538
13 2.69016 4.00000 -0.00538 27.00000 2.69042 -0.00252
14 2.69042 4.00000 -0.00252 27.00000 2.69054 -0.00118
15 2.69054 4.00000 -0.00118 27.00000 2.69060 -0.00055
16 2.69060 4.00000 -0.00055 27.00000 2.69062 -0.00026
17 2.69062 4.00000 -0.00026 27.00000 2.69064 -0.00012
18 2.69064 4.00000 -0.00012 27.00000 2.69064 -0.00006 <0.0001

Therefore, the solution is 2.69064.

b)

1 -3.00000 -2.00000 -1.00000 3.00000 -2.75000 0.89063


2 -3.00000 -2.75000 -1.00000 0.89063 -2.86777 0.08748
3 -3.00000 -2.86777 -1.00000 0.08748 -2.87841 0.00743
4 -3.00000 -2.87841 -1.00000 0.00743 -2.87930 0.00062
5 -3.00000 -2.87930 -1.00000 0.00062 -2.87938 0.00005 <0.0001

Therefore, the solution is −2.87938.

c)

1 0.00000 1.57080 -1.00000 1.57080 0.61102 -0.20805


2 0.61102 1.57080 -0.20805 1.57080 0.72327 -0.02638
3 0.72327 1.57080 -0.02638 1.57080 0.73727 -0.00304
4 0.73727 1.57080 -0.00304 1.57080 0.73888 -0.00035
5 0.73888 1.57080 -0.00035 1.57080 0.73906 -0.00004 <0.0001
6 0.73906 1.57080 -0.00004 1.57080 0.73908 0.00000 <0.0001

Therefore, the solution is 0.73908. The answer of 0.73906 is also acceptable.

d)

8
1 0.00000 1.57080 -0.80000 0.57080 0.91672 -0.04200
2 0.91672 1.57080 -0.04200 0.57080 0.96155 -0.00246
3 0.96155 1.57080 -0.00246 0.57080 0.96417 -0.00014
4 0.96417 1.57080 -0.00014 0.57080 0.96432 -0.00001 <0.0001
5 0.96432 1.57080 -0.00001 0.57080 0.96433 0.00000 <0.0001

Therefore, the solution is 0.96433. The answer of 0.96432 is also acceptable.

11. The fourth-degree polynomial f ( x ) = 230 x 4 + 18 x3 + 9 x 2 − 221x − 9 has two real


zeros, one in  −1, 0 and the other in  0,1 . Attempt to approximate these zeros to within
10 −6 using the
a) Method of false position
b) Secant method
c) Newton’s method.
Round the answer correct to 6 decimal places.

Solution:

a) Method of false position

1 -1.000000 0.000000 433.000000 -9.000000 -0.020362 -4.496381


2 -1.000000 -0.020362 433.000000 -4.496381 -0.030430 -2.266891
3 -1.000000 -0.030430 433.000000 -2.266891 -0.035480 -1.148071
4 -1.000000 -0.035480 433.000000 -1.148071 -0.038030 -0.582771
5 -1.000000 -0.038030 433.000000 -0.582771 -0.039323 -0.296161
6 -1.000000 -0.039323 433.000000 -0.296161 -0.039980 -0.150595
7 -1.000000 -0.039980 433.000000 -0.150595 -0.040314 -0.076599
8 -1.000000 -0.040314 433.000000 -0.076599 -0.040484 -0.038967
9 -1.000000 -0.040484 433.000000 -0.038967 -0.040570 -0.019825
10 -1.000000 -0.040570 433.000000 -0.019825 -0.040614 -0.010087
11 -1.000000 -0.040614 433.000000 -0.010087 -0.040636 -0.005132
12 -1.000000 -0.040636 433.000000 -0.005132 -0.040648 -0.002611
13 -1.000000 -0.040648 433.000000 -0.002611 -0.040653 -0.001329
14 -1.000000 -0.040653 433.000000 -0.001329 -0.040656 -0.000676
15 -1.000000 -0.040656 433.000000 -0.000676 -0.040658 -0.000344
16 -1.000000 -0.040658 433.000000 -0.000344 -0.040658 -0.000175
17 -1.000000 -0.040658 433.000000 -0.000175 -0.040659 -0.000089
18 -1.000000 -0.040659 433.000000 -0.000089 -0.040659 -0.000045
19 -1.000000 -0.040659 433.000000 -0.000045 -0.040659 -0.000023
20 -1.000000 -0.040659 433.000000 -0.000023 -0.040659 -0.000012
21 -1.000000 -0.040659 433.000000 -0.000012 -0.040659 -0.000006
22 -1.000000 -0.040659 433.000000 -0.000006 -0.040659 -0.000003
23 -1.000000 -0.040659 433.000000 -0.000003 -0.040659 -0.000002
24 -1.000000 -0.040659 433.000000 -0.000002 -0.040659 -0.000001 <0.000001
Therefore, the root in  −1, 0 is −0.040659.

9
1 0.000000 1.000000 -9.000000 27.000000 0.250000 -62.507813
2 0.250000 1.000000 -62.507813 27.000000 0.773763 -83.830520
3 0.773763 1.000000 -83.830520 27.000000 0.944885 -11.265130
4 0.944885 1.000000 -11.265130 27.000000 0.961111 -0.855868
5 0.961111 1.000000 -0.855868 27.000000 0.962306 -0.061802
6 0.962306 1.000000 -0.061802 27.000000 0.962392 -0.004446
7 0.962392 1.000000 -0.004446 27.000000 0.962398 -0.000320
8 0.962398 1.000000 -0.000320 27.000000 0.962398 -0.000023
9 0.962398 1.000000 -0.000023 27.000000 0.962398 -0.000002
10 0.962398 1.000000 -0.000002 27.000000 0.962398 0.000000 <0.000001

Therefore, the root in  0,1 is 0.962398.


b) Secant method

1 -1.000000 0.000000 433.000000 -9.000000 -0.020362 -4.496381


2 0.000000 -0.020362 -9.000000 -4.496381 -0.040691 0.007087
3 -0.020362 -0.040691 -4.496381 0.007087 -0.040659 -0.000006
4 -0.040691 -0.040659 0.007087 -0.000006 -0.040659 0.000000 <0.000001

Therefore, the root in  −1, 0 is −0.040659.

1 0.000000 1.000000 -9.000000 27.000000 0.250000 -62.507813


2 1.000000 0.250000 27.000000 -62.507813 0.773763 -83.830520
3 0.250000 0.773763 -62.507813 -83.830520 -1.285418 879.638986
4 0.773763 -1.285418 -83.830520 879.638986 0.594596 -104.691389
5 -1.285418 0.594596 879.638986 -104.691389 0.394641 -88.128940
6 0.594596 0.394641 -104.691389 -88.128940 -0.669318 183.713160
7 0.394641 -0.669318 -88.128940 183.713160 0.049714 -19.961022
8 -0.669318 0.049714 183.713160 -19.961022 -0.020754 -4.409574
9 0.049714 -0.020754 -19.961022 -4.409574 -0.040735 0.016859
10 -0.020754 -0.040735 -4.409574 0.016859 -0.040659 -0.000013
11 -0.040735 -0.040659 0.016859 -0.000013 -0.040659 0.000000 <0.000001

Therefore, the root in  0,1 is −0.040659.

c) Newton’s method

0 -1.000000 433.000000 -1105.000000 -0.608145 0.391855


1 -0.608145 156.139857 -418.898263 -0.235405 0.372739
2 -0.235405 43.994845 -234.246403 -0.047591 0.187814
3 -0.047591 1.537252 -221.833501 -0.040661 0.006930
4 -0.040661 0.000451 -221.704472 -0.040659 0.000002
5 -0.040659 0.000000 -221.704435 -0.040659 0.000000 <0.000001

Therefore, the root in  −1, 0 is −0.040659.

0 1.000000 27.000000 771.000000 0.964981 0.035019


1 0.964981 1.729703 673.345325 0.962412 0.002569
2 0.962412 0.008868 666.447219 0.962398 0.000013
3 0.962398 0.000000 666.411582 0.962398 0.000000 <0.000001
Therefore, the root in  0,1 is 0.962398.

10

You might also like