SlideShare a Scribd company logo
Laurence V. Fausett, Applied Numerical Analysis, Using MATLAB, Pearson,
BISECTION METHOD
p.2.1
[1 2]
step a b m ym bound
1.0000 1.0000 2.0000 1.5000 0.2500 0.5000
2.0000 1.0000 1.5000 1.2500 -0.4375 0.2500
3.0000 1.2500 1.5000 1.3750 -0.1094 0.1250
4.0000 1.3750 1.5000 1.4375 0.0664 0.0625
5.0000 1.3750 1.4375 1.4063 -0.0225 0.0313
6.0000 1.4063 1.4375 1.4219 0.0217 0.0156
7.0000 1.4063 1.4219 1.4141 -0.0004 0.0078
zero not foundto desired tolerance
p.2.2
[ 2 3]
step a b m ym bound
1.0000 2.0000 3.0000 2.5000 1.2500 0.5000
2.0000 2.0000 2.5000 2.2500 0.0625 0.2500
3.0000 2.0000 2.2500 2.1250 -0.4844 0.1250
4.0000 2.1250 2.2500 2.1875 -0.2148 0.0625
5.0000 2.1875 2.2500 2.2188 -0.0771 0.0313
6.0000 2.2188 2.2500 2.2344 -0.0076 0.0156
7.0000 2.2344 2.2500 2.2422 0.0274 0.0078
8.0000 2.2344 2.2422 2.2383 0.0099 0.0039
zero not foundto desiredtolerence
p.2.3
[ 2 3]
step a b m ym bound
1.0000 2.0000 3.0000 2.5000 -0.7500 0.5000
2.0000 2.5000 3.0000 2.7500 0.5625 0.2500
3.0000 2.5000 2.7500 2.6250 -0.1094 0.1250
4.0000 2.6250 2.7500 2.6875 0.2227 0.0625
5.0000 2.6250 2.6875 2.6563 0.0557 0.0313
6.0000 2.6250 2.6563 2.6406 -0.0271 0.0156
zero not foundto desired tolerance
p.2.4
[1 2]
step a b m ym bound
1.0000 1.0000 2.0000 1.5000 0.3750 0.5000
2.0000 1.0000 1.5000 1.2500 -1.0469 0.2500
3.0000 1.2500 1.5000 1.3750 -0.4004 0.1250
4.0000 1.3750 1.5000 1.4375 -0.0295 0.0625
5.0000 1.4375 1.5000 1.4688 0.1684 0.0313
6.0000 1.4375 1.4688 1.4531 0.0684 0.0156
7.0000 1.4375 1.4531 1.4453 0.0192 0.0078
8.0000 1.4375 1.4453 1.4414 -0.0053 0.0039
9.0000 1.4414 1.4453 1.4434 0.0069 0.0020
10.0000 1.4414 1.4434 1.4424 0.0008 0.0010
zero not foundto desired tolerance
p.2.5
[1 2]
step a b m ym bound
1.0000 1.0000 2.0000 1.5000 -0.6250 0.5000
2.0000 1.5000 2.0000 1.7500 1.3594 0.2500
3.0000 1.5000 1.7500 1.6250 0.2910 0.1250
4.0000 1.5000 1.6250 1.5625 -0.1853 0.0625
5.0000 1.5625 1.6250 1.5938 0.0482 0.0313
6.0000 1.5625 1.5938 1.5781 -0.0697 0.0156
7.0000 1.5781 1.5938 1.5859 -0.0111 0.0078
zero not foundto desiredtolerance
p.2.6
[1 2]
step a b m ym bound
1.0000 1.0000 2.0000 1.5000 -2.6250 0.5000
2.0000 1.5000 2.0000 1.7500 -0.6406 0.2500
3.0000 1.7500 2.0000 1.8750 0.5918 0.1250
4.0000 1.7500 1.8750 1.8125 -0.0457 0.0625
5.0000 1.8125 1.8750 1.8438 0.2677 0.0313
6.0000 1.8125 1.8438 1.8281 0.1097 0.0156
7.0000 1.8125 1.8281 1.8203 0.0317 0.0078
zero not foundto desiredtolerance
p.2.7
[ 0 1]
step a b m ym bound
1.0000 0 1.0000 0.5000 -0.3875 0.5000
2.0000 0.5000 1.0000 0.7500 -0.1336 0.2500
3.0000 0.7500 1.0000 0.8750 0.1362 0.1250
4.0000 0.7500 0.8750 0.8125 -0.0142 0.0625
5.0000 0.8125 0.8750 0.8438 0.0568 0.0313
6.0000 0.8125 0.8438 0.8281 0.0203 0.0156
7.0000 0.8125 0.8281 0.8203 0.0028 0.0078
zero not foundto desiredtolerance
p.2.8
[ 0 1]
step a b m ym bound
1.0000 0 1.0000 0.5000 -0.5875 0.5000
2.0000 0.5000 1.0000 0.7500 -0.3336 0.2500
3.0000 0.7500 1.0000 0.8750 -0.0638 0.1250
4.0000 0.8750 1.0000 0.9375 0.1225 0.0625
5.0000 0.8750 0.9375 0.9063 0.0245 0.0313
6.0000 0.8750 0.9063 0.8906 -0.0208 0.0156
7.0000 0.8906 0.9063 0.8984 0.0016 0.0078
zero not foundto desired tolerance
p.2.9
[ 0 1]
step a b m ym bound
1.0000 0 1.0000 0.5000 0.0025 0.5000
2.0000 0 0.5000 0.2500 -0.0561 0.2500
3.0000 0.2500 0.5000 0.3750 -0.0402 0.1250
4.0000 0.3750 0.5000 0.4375 -0.0234 0.0625
5.0000 0.4375 0.5000 0.4688 -0.0117 0.0313
6.0000 0.4688 0.5000 0.4844 -0.0050 0.0156
7.0000 0.4844 0.5000 0.4922 -0.0013 0.0078
zero not foundto desiredtolerence
p.2.10
[ 0 1]
step a b m ym bound
1.0000 0 1.0000 0.5000 -0.1875 0.5000
2.0000 0.5000 1.0000 0.7500 0.0664 0.2500
3.0000 0.5000 0.7500 0.6250 -0.0974 0.1250
4.0000 0.6250 0.7500 0.6875 -0.0266 0.0625
5.0000 0.6875 0.7500 0.7188 0.0169 0.0313
6.0000 0.6875 0.7188 0.7031 -0.0056 0.0156
7.0000 0.7031 0.7188 0.7109 0.0055 0.0078
zero not foundto desired tolerance
p.2.11
(a) [0 1]
step a b m ym bound
1.0000 0 1.0000 0.5000 -2.3750 0.5000
2.0000 0 0.5000 0.2500 -0.2344 0.2500
3.0000 0 0.2500 0.1250 0.8770 0.1250
4.0000 0.1250 0.2500 0.1875 0.3191 0.0625
5.0000 0.1875 0.2500 0.2188 0.0417 0.0313
6.0000 0.2188 0.2500 0.2344 -0.0965 0.0156
7.0000 0.2188 0.2344 0.2266 -0.0274 0.0078
8.0000 0.2188 0.2266 0.2227 0.0071 0.0039
9.0000 0.2227 0.2266 0.2246 -0.0102 0.0020
10.0000 0.2227 0.2246 0.2236 -0.0015 0.0010
zero not foundto desired tolerance
(b) [2 3]
step a b m ym bound
1.0000 2.0000 3.0000 2.5000 -4.8750 0.5000
2.0000 2.5000 3.0000 2.7500 -1.9531 0.2500
3.0000 2.7500 3.0000 2.8750 -0.1113 0.1250
4.0000 2.8750 3.0000 2.9375 0.9099 0.0625
5.0000 2.8750 2.9375 2.9063 0.3908 0.0313
6.0000 2.8750 2.9063 2.8906 0.1376 0.0156
7.0000 2.8750 2.8906 2.8828 0.0126 0.0078
8.0000 2.8750 2.8828 2.8789 -0.0495 0.0039
9.0000 2.8789 2.8828 2.8809 -0.0185 0.0020
10.0000 2.8809 2.8828 2.8818 -0.0029 0.0010
zero not foundto desired tolerance
(c) [-3 -4]
step a b m ym bound
1.0000 -3.0000 -4.0000 -3.5000 -9.3750 -0.5000
2.0000 -3.0000 -3.5000 -3.2500 -3.0781 -0.2500
3.0000 -3.0000 -3.2500 -3.1250 -0.3926 -0.1250
4.0000 -3.0000 -3.1250 -3.0625 0.8396 -0.0625
5.0000 -3.0625 -3.1250 -3.0938 0.2326 -0.0313
6.0000 -3.0938 -3.1250 -3.1094 -0.0777 -0.0156
7.0000 -3.0938 -3.1094 -3.1016 0.0780 -0.0078
8.0000 -3.1016 -3.1094 -3.1055 0.0003 -0.0039
zero not foundto desired tolerance
p.2.12
one real and 2 imaginary roots
step a b m ym bound
1.0000 2.0000 3.0000 2.5000 -1.8750 0.5000
2.0000 2.5000 3.0000 2.7500 0.6719 0.2500
3.0000 2.5000 2.7500 2.6250 -0.6934 0.1250
4.0000 2.6250 2.7500 2.6875 -0.0344 0.0625
5.0000 2.6875 2.7500 2.7188 0.3127 0.0313
6.0000 2.6875 2.7188 2.7031 0.1377 0.0156
7.0000 2.6875 2.7031 2.6953 0.0512 0.0078
8.0000 2.6875 2.6953 2.6914 0.0083 0.0039
9.0000 2.6875 2.6914 2.6895 -0.0131 0.0020
10.0000 2.6895 2.6914 2.6904 -0.0024 0.0010
zero not foundto desiredtolerence
p.2.13
(a) [0 1]
step a b m ym bound
1.0000 0 1.0000 0.5000 -0.1250 0.5000
2.0000 0.5000 1.0000 0.7500 1.1094 0.2500
3.0000 0.5000 0.7500 0.6250 0.4160 0.1250
4.0000 0.5000 0.6250 0.5625 0.1272 0.0625
5.0000 0.5000 0.5625 0.5313 -0.0034 0.0313
6.0000 0.5313 0.5625 0.5469 0.0608 0.0156
7.0000 0.5313 0.5469 0.5391 0.0284 0.0078
8.0000 0.5313 0.5391 0.5352 0.0124 0.0039
9.0000 0.5313 0.5352 0.5332 0.0045 0.0020
10.0000 0.5313 0.5332 0.5322 0.0006 0.0010
zero not foundto desiredtolerence
(b) [0 -1]
step a b m ym bound
1.0000 0 -1.0000 -0.5000 -0.3750 -0.5000
2.0000 -0.5000 -1.0000 -0.7500 0.2656 -0.2500
3.0000 -0.5000 -0.7500 -0.6250 -0.0723 -0.1250
4.0000 -0.6250 -0.7500 -0.6875 0.0930 -0.0625
5.0000 -0.6250 -0.6875 -0.6563 0.0094 -0.0313
6.0000 -0.6250 -0.6563 -0.6406 -0.0317 -0.0156
7.0000 -0.6406 -0.6563 -0.6484 -0.0112 -0.0078
8.0000 -0.6484 -0.6563 -0.6523 -0.0009 -0.0039
9.0000 -0.6523 -0.6563 -0.6543 0.0042 -0.0020
10.0000 -0.6523 -0.6543 -0.6533 0.0016 -0.0010
(c) [-2 -3]
step a b m ym bound
1.0000 -2.0000 -3.0000 -2.5000 2.1250 -0.5000
2.0000 -2.5000 -3.0000 -2.7500 0.8906 -0.2500
3.0000 -2.7500 -3.0000 -2.8750 0.0332 -0.1250
4.0000 -2.8750 -3.0000 -2.9375 -0.4607 -0.0625
5.0000 -2.8750 -2.9375 -2.9063 -0.2082 -0.0313
6.0000 -2.8750 -2.9063 -2.8906 -0.0861 -0.0156
7.0000 -2.8750 -2.8906 -2.8828 -0.0261 -0.0078
8.0000 -2.8750 -2.8828 -2.8789 0.0036 -0.0039
9.0000 -2.8789 -2.8828 -2.8809 -0.0112 -0.0020
10.0000 -2.8789 -2.8809 -2.8799 -0.0038 -0.0010
zero not foundto desired tolerance
p.2.14
(a) [0 1]
step a b m ym bound
1.0000 0 1.0000 0.5000 -0.8750 0.5000
2.0000 0 0.5000 0.2500 0.0156 0.2500
3.0000 0.2500 0.5000 0.3750 -0.4473 0.1250
4.0000 0.2500 0.3750 0.3125 -0.2195 0.0625
5.0000 0.2500 0.3125 0.2813 -0.1028 0.0313
6.0000 0.2500 0.2813 0.2656 -0.0438 0.0156
7.0000 0.2500 0.2656 0.2578 -0.0141 0.0078
8.0000 0.2500 0.2578 0.2539 0.0007 0.0039
9.0000 0.2539 0.2578 0.2559 -0.0067 0.0020
10.0000 0.2539 0.2559 0.2549 -0.0030 0.0010
zero not foundto desired tolerance
(b) [1 2]
step a b m ym bound
1.0000 1.0000 2.0000 1.5000 -1.6250 0.5000
2.0000 1.5000 2.0000 1.7500 -0.6406 0.2500
3.0000 1.7500 2.0000 1.8750 0.0918 0.1250
4.0000 1.7500 1.8750 1.8125 -0.2957 0.0625
5.0000 1.8125 1.8750 1.8438 -0.1073 0.0313
6.0000 1.8438 1.8750 1.8594 -0.0091 0.0156
7.0000 1.8594 1.8750 1.8672 0.0410 0.0078
8.0000 1.8594 1.8672 1.8633 0.0158 0.0039
9.0000 1.8594 1.8633 1.8613 0.0033 0.0020
10.0000 1.8594 1.8613 1.8604 -0.0029 0.0010
zero not foundto desired tolerance
(c) [-2 -3]
step a b m ym bound
1.0000 -2.0000 -3.0000 -2.5000 -4.6250 -0.5000
2.0000 -2.0000 -2.5000 -2.2500 -1.3906 -0.2500
3.0000 -2.0000 -2.2500 -2.1250 -0.0957 -0.1250
4.0000 -2.0000 -2.1250 -2.0625 0.4763 -0.0625
5.0000 -2.0625 -2.1250 -2.0938 0.1964 -0.0313
6.0000 -2.0938 -2.1250 -2.1094 0.0519 -0.0156
7.0000 -2.1094 -2.1250 -2.1172 -0.0215 -0.0078
8.0000 -2.1094 -2.1172 -2.1133 0.0153 -0.0039
9.0000 -2.1133 -2.1172 -2.1152 -0.0031 -0.0020
10.0000 -2.1133 -2.1152 -2.1143 0.0061 -0.0010
zero not foundto desiredtolerence
>>
p.2.15
[2 3]
step a b m ym bound
1.0000 2.0000 3.0000 2.5000 -3.6250 0.5000
2.0000 2.5000 3.0000 2.7500 -0.7656 0.2500
3.0000 2.7500 3.0000 2.8750 0.9980 0.1250
4.0000 2.7500 2.8750 2.8125 0.0872 0.0625
5.0000 2.7500 2.8125 2.7813 -0.3464 0.0313
6.0000 2.7813 2.8125 2.7969 -0.1314 0.0156
7.0000 2.7969 2.8125 2.8047 -0.0226 0.0078
8.0000 2.8047 2.8125 2.8086 0.0322 0.0039
9.0000 2.8047 2.8086 2.8066 0.0048 0.0020
10.0000 2.8047 2.8066 2.8057 -0.0089 0.0010
zero not foundto desired tolerance
p.2.16
[0 1]
step a b m ym bound
1.0000 0 1.0000 0.5000 -0.8750 0.5000
2.0000 0.5000 1.0000 0.7500 0.2969 0.2500
3.0000 0.5000 0.7500 0.6250 -0.2246 0.1250
4.0000 0.6250 0.7500 0.6875 0.0515 0.0625
5.0000 0.6250 0.6875 0.6563 -0.0826 0.0313
6.0000 0.6563 0.6875 0.6719 -0.0146 0.0156
7.0000 0.6719 0.6875 0.6797 0.0187 0.0078
8.0000 0.6719 0.6797 0.6758 0.0021 0.0039
9.0000 0.6719 0.6758 0.6738 -0.0062 0.0020
10.0000 0.6738 0.6758 0.6748 -0.0020 0.0010
zero not foundto desiredtolerence
p.2.17
(a) [ 1 2]
step a b m ym bound
1.0000 1.0000 2.0000 1.5000 -1.5000 0.5000
2.0000 1.0000 1.5000 1.2500 0.7813 0.2500
3.0000 1.2500 1.5000 1.3750 -0.3867 0.1250
4.0000 1.2500 1.3750 1.3125 0.1948 0.0625
5.0000 1.3125 1.3750 1.3438 -0.0971 0.0313
6.0000 1.3125 1.3438 1.3281 0.0486 0.0156
7.0000 1.3281 1.3438 1.3359 -0.0243 0.0078
8.0000 1.3281 1.3359 1.3320 0.0122 0.0039
9.0000 1.3320 1.3359 1.3340 -0.0061 0.0020
10.0000 1.3320 1.3340 1.3330 0.0030 0.0010
zero not foundto desiredtolerence
(b) [2 3]
step a b m ym bound
1.0000 2.0000 3.0000 2.5000 0 0.5000
bisectionhas converged
(c)
0
p.2.18
(a) [0 1]
step a b m ym bound
1.0000 0 1.0000 0.5000 -2.8750 0.5000
2.0000 0 0.5000 0.2500 1.4844 0.2500
3.0000 0.2500 0.5000 0.3750 -0.7324 0.1250
4.0000 0.2500 0.3750 0.3125 0.3689 0.0625
5.0000 0.3125 0.3750 0.3438 -0.1838 0.0313
6.0000 0.3125 0.3438 0.3281 0.0921 0.0156
7.0000 0.3281 0.3438 0.3359 -0.0460 0.0078
8.0000 0.3281 0.3359 0.3320 0.0230 0.0039
9.0000 0.3320 0.3359 0.3340 -0.0115 0.0020
10.0000 0.3320 0.3340 0.3330 0.0058 0.0010
zero not foundto desiredtolerence
(b) [-2 -3]
step a b m ym bound
1.0000 -2.0000 -3.0000 -2.5000 -2.1250 -0.5000
2.0000 -2.0000 -2.5000 -2.2500 7.2656 -0.2500
3.0000 -2.2500 -2.5000 -2.3750 2.9199 -0.1250
4.0000 -2.3750 -2.5000 -2.4375 0.4871 -0.0625
5.0000 -2.4375 -2.5000 -2.4688 -0.7963 -0.0313
6.0000 -2.4375 -2.4688 -2.4531 -0.1490 -0.0156
7.0000 -2.4375 -2.4531 -2.4453 0.1704 -0.0078
8.0000 -2.4453 -2.4531 -2.4492 0.0111 -0.0039
9.0000 -2.4492 -2.4531 -2.4512 -0.0689 -0.0020
10.0000 -2.4492 -2.4512 -2.4502 -0.0289 -0.0010
zero not foundto desired tolerance
(c) [2 3]
step a b m ym bound
1.0000 2.0000 3.0000 2.5000 1.6250 0.5000
2.0000 2.0000 2.5000 2.2500 -5.3906 0.2500
3.0000 2.2500 2.5000 2.3750 -2.2012 0.1250
4.0000 2.3750 2.5000 2.4375 -0.3699 0.0625
5.0000 2.4375 2.5000 2.4688 0.6068 0.0313
6.0000 2.4375 2.4688 2.4531 0.1133 0.0156
7.0000 2.4375 2.4531 2.4453 -0.1295 0.0078
8.0000 2.4453 2.4531 2.4492 -0.0084 0.0039
9.0000 2.4492 2.4531 2.4512 0.0524 0.0020
10.0000 2.4492 2.4512 2.4502 0.0220 0.0010
zero not foundto desired tolerance
p.2.19
(a) [-1 -2]
step a b m ym bound
1.0000 -1.0000 -2.0000 -1.5000 -1.6250 -0.5000
2.0000 -1.5000 -2.0000 -1.7500 1.5781 -0.2500
3.0000 -1.5000 -1.7500 -1.6250 0.0684 -0.1250
4.0000 -1.5000 -1.6250 -1.5625 -0.7561 -0.0625
5.0000 -1.5625 -1.6250 -1.5938 -0.3382 -0.0313
6.0000 -1.5938 -1.6250 -1.6094 -0.1335 -0.0156
7.0000 -1.6094 -1.6250 -1.6172 -0.0322 -0.0078
8.0000 -1.6172 -1.6250 -1.6211 0.0182 -0.0039
9.0000 -1.6172 -1.6211 -1.6191 -0.0070 -0.0020
10.0000 -1.6191 -1.6211 -1.6201 0.0056 -0.0010
zero not foundto desiredtolerence
(b) [5 6]
step a b m ym bound
1.0000 5.0000 6.0000 5.5000 -27.8750 0.5000
2.0000 5.5000 6.0000 5.7500 -12.9531 0.2500
3.0000 5.7500 6.0000 5.8750 -4.7363 0.1250
4.0000 5.8750 6.0000 5.9375 -0.4338 0.0625
5.0000 5.9375 6.0000 5.9688 1.7666 0.0313
6.0000 5.9375 5.9688 5.9531 0.6623 0.0156
7.0000 5.9375 5.9531 5.9453 0.1132 0.0078
8.0000 5.9375 5.9453 5.9414 -0.1606 0.0039
9.0000 5.9414 5.9453 5.9434 -0.0238 0.0020
10.0000 5.9434 5.9453 5.9443 0.0447 0.0010
zero not foundto desiredtolerence
(c) [-3 -4]
step a b m ym bound
1.0000 -3.0000 -4.0000 -3.5000 -3.1250 -0.5000
2.0000 -3.0000 -3.5000 -3.2500 1.1094 -0.2500
3.0000 -3.2500 -3.5000 -3.3750 -0.8340 -0.1250
4.0000 -3.2500 -3.3750 -3.3125 0.1804 -0.0625
5.0000 -3.3125 -3.3750 -3.3438 -0.3160 -0.0313
6.0000 -3.3125 -3.3438 -3.3281 -0.0651 -0.0156
7.0000 -3.3125 -3.3281 -3.3203 0.0583 -0.0078
8.0000 -3.3203 -3.3281 -3.3242 -0.0032 -0.0039
9.0000 -3.3203 -3.3242 -3.3223 0.0276 -0.0020
10.0000 -3.3223 -3.3242 -3.3232 0.0122 -0.0010
zero not foundto desiredtolerence
p.2.20
(a) [3 4]
step a b m ym bound
1.0000 3.0000 4.0000 3.5000 -0.8750 0.5000
2.0000 3.5000 4.0000 3.7500 -0.2031 0.2500
3.0000 3.7500 4.0000 3.8750 0.3262 0.1250
4.0000 3.7500 3.8750 3.8125 0.0442 0.0625
5.0000 3.7500 3.8125 3.7813 -0.0837 0.0313
6.0000 3.7813 3.8125 3.7969 -0.0208 0.0156
7.0000 3.7969 3.8125 3.8047 0.0114 0.0078
8.0000 3.7969 3.8047 3.8008 -0.0048 0.0039
9.0000 3.8008 3.8047 3.8027 0.0033 0.0020
10.0000 3.8008 3.8027 3.8018 -0.0007 0.0010
zero not foundto desiredtolerence
(b) [0 1]
step a b m ym bound
1.0000 0 1.0000 0.5000 -1.6250 0.5000
2.0000 0.5000 1.0000 0.7500 -0.0156 0.2500
3.0000 0.7500 1.0000 0.8750 0.5605 0.1250
4.0000 0.7500 0.8750 0.8125 0.2903 0.0625
5.0000 0.7500 0.8125 0.7813 0.1419 0.0313
6.0000 0.7500 0.7813 0.7656 0.0643 0.0156
7.0000 0.7500 0.7656 0.7578 0.0246 0.0078
8.0000 0.7500 0.7578 0.7539 0.0046 0.0039
9.0000 0.7500 0.7539 0.7520 -0.0055 0.0020
10.0000 0.7520 0.7539 0.7529 -0.0005 0.0010
zero not foundto desiredtolerence
>>
SECANT METHOD
p.2.1
[-1 2]
secant(inline('x^2-2'),-1,2,0.005,7)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1 -1 2 0 -2 -2
2 2 0 1 -1 1
3 0 1 2 2 1
4 1.0000 2.0000 1.3333 -0.2222 -0.6667
5 2.0000 1.3333 1.4000 -0.0400 0.0667
6 1.3333 1.4000 1.4146 0.0012 0.0146
secantmethod has converged
ans =
1.4146
p.2.2
[ 2 3]
secant(inline('x^2-5'),2,3,0.005,7)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1 2.0000 3.0000 2.2000 -0.1600 -0.8000
2 3.0000 2.2000 2.2308 -0.0237 0.0308
3 2.2000 2.2308 2.2361 0.0002 0.0053
secantmethod has converged
ans =
2.2361
p.2.3
[ 2 3]
>> secant(inline('x^2-7'),2,3,0.005,7)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1 2.0000 3.0000 2.6000 -0.2400 -0.4000
2 3.0000 2.6000 2.6429 -0.0153 0.0429
3 2.6000 2.6429 2.6458 0.0001 0.0029
secantmethod has converged
ans =
2.6458
p.2.4
[1 2]
secant(inline('x^3-6'),1,2,0.005,7)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1 1.0000 2.0000 1.7143 -0.9621 -0.2857
2 2.0000 1.7143 1.8071 -0.0988 0.0928
3 1.7143 1.8071 1.8177 0.0059 0.0106
4. 1.8071 1.8177 1.8171 -0.0000 -0.0006
secantmethod has converged
ans =
1.8171
p.2.5
[1 2]
secant(inline('x^3-4'),1,2,0.005,7)
step x(k-1) x (k) x(k+1) y(k+1) dx(k+1)
1 1.0000 2.0000 1.4286 -1.0845 -0.5714
2 2.0000 1.4286 1.5505 -0.2728 0.1219
3 1.4286 1.5505 1.5914 0.0305 0.0410
4 1.5505 1.5914 1.5873 -0.0007 -0.0041
secantmethod has converged
ans =
1.5873
p.2.6
[1 2]
secant(inline('x^3-6'),1,2,0.005,7)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 1.0000 2.0000 1.7143 -0.9621 -0.2857
2.0000 2.0000 1.7143 1.8071 -0.0988 0.0928
3.0000 1.7143 1.8071 1.8177 0.0059 0.0106
4.0000 1.8071 1.8177 1.8171 -0.0000 -0.0006
secantmethod has converged
ans =
1.8171
p.2.7
[ 0 1]
secant(inline('x^4-0.45'),0,1,0.005,7)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 0 1.0000 0.4500 -0.4090 -0.5500
2.0000 1.0000 0.4500 0.6846 -0.2304 0.2346
3.0000 0.4500 0.6846 0.9871 0.4995 0.3026
4.0000 0.6846 0.9871 0.7801 -0.0797 -0.2071
5.0000 0.9871 0.7801 0.8086 -0.0226 0.0285
6.0000 0.7801 0.8086 0.8198 0.0017 0.0113
secantmethod has converged
ans =
0.8198
p.2.8
[ 0 1]
secant(inline('x^4-0.65'),0,1,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 0 1.0000 0.6500 -0.4715 -0.3500
2.0000 1.0000 0.6500 0.8509 -0.1258 0.2009
3.0000 0.6500 0.8509 0.9240 0.0789 0.0731
4.0000 0.8509 0.9240 0.8958 -0.0060 -0.0282
5.0000 0.9240 0.8958 0.8978 -0.0003 0.0020
secantmethod has converged
ans =
0.8978
>>
p.2.9
sm prob of e
p.2.10
[ 0 1]
secant(inline('x^4-0.25'),0,1,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 0 1.0000 0.2500 -0.2461 -0.7500
2.0000 1.0000 0.2500 0.4353 -0.2141 0.1853
3.0000 0.2500 0.4353 1.6751 7.6241 1.2398
4.0000 0.4353 1.6751 0.4692 -0.2016 -1.2060
5.0000 1.6751 0.4692 0.5002 -0.1874 0.0311
6.0000 0.4692 0.5002 0.9112 0.4395 0.4110
7.0000 0.5002 0.9112 0.6231 -0.0993 -0.2881
ans =
0.6231
>>
p.2.11
(a) [0 1]
secant(inline('x^3-9*x+2'),0,1,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 0 1.0000 0.2500 -0.2344 -0.7500
2.0000 1.0000 0.2500 0.2195 0.0350 -0.0305
3.0000 0.2500 0.2195 0.2235 -0.0001 0.0040
secantmethod has converged
ans =
0.2235
(b) [-3 -4]
secant(inline('x^3-9*x+2'),-3,-4,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 -3.0000 -4.0000 -3.0714 0.6680 0.9286
2.0000 -4.0000 -3.0714 -3.0947 0.2141 -0.0233
3.0000 -3.0714 -3.0947 -3.1057 -0.0035 -0.0110
secantmethod has converged
ans =
-3.1057
(c) [2 3]
secant(inline('x^3-9*x+2'),2,3,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 2.0000 3.0000 2.8000 -1.2480 -0.2000
2.0000 3.0000 2.8000 2.8768 -0.0821 0.0768
3.0000 2.8000 2.8768 2.8823 0.0038 0.0054
secantmethod has converged
ans =
2.8823
>>
p.2.12
secant(inline('x^3-2*x^2-5'),2,3,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 2.0000 3.0000 2.5556 -1.3717 -0.4444
2.0000 3.0000 2.5556 2.6691 -0.2338 0.1135
3.0000 2.5556 2.6691 2.6924 0.0189 0.0233
4.0000 2.6691 2.6924 2.6906 -0.0002 -0.0017
secantmethod has converged
ans =
2.6906
p.2.13
(a) [-2 -3]
secant(inline('x^3+3*x^2-1'),-2,-3,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 -2.0000 -3.0000 -2.7500 0.8906 0.2500
2.0000 -3.0000 -2.7500 -2.8678 0.0875 -0.1178
3.0000 -2.7500 -2.8678 -2.8806 -0.0092 -0.0128
4.0000 -2.8678 -2.8806 -2.8794 0.0001 0.0012
secantmethod has converged
ans =
-2.8794
(b) [0 -1]
secant(inline('x^3+3*x^2-1'),0,-1,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 0 -1.0000 -0.5000 -0.3750 0.5000
2.0000 -1.0000 -0.5000 -0.6364 -0.0428 -0.1364
3.0000 -0.5000 -0.6364 -0.6539 0.0033 -0.0176
secantmethod has converged
ans =
-0.6539
(c) [0 1]
secant(inline('x^3+3*x^2-1'),0,1,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 0 1.0000 0.2500 -0.7969 -0.7500
2.0000 1.0000 0.2500 0.4074 -0.4344 0.1574
3.0000 0.2500 0.4074 0.5961 0.2777 0.1887
4.0000 0.4074 0.5961 0.5225 -0.0383 -0.0736
5.0000 0.5961 0.5225 0.5314 -0.0027 0.0089
secantmethod has converged
ans =
0.5314
p.2.14
(a) [0 1]
secant(inline('x^3-4*x+1'),0,1,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 0 1.0000 0.3333 -0.2963 -0.6667
2.0000 1.0000 0.3333 0.2174 0.1407 -0.1159
3.0000 0.3333 0.2174 0.2547 -0.0024 0.0373
secantmethod has converged
ans =
0.2547
(b) [1 2]
secant(inline('x^3-4*x+1'),1,2,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 1.0000 2.0000 1.6667 -1.0370 -0.3333
2.0000 2.0000 1.6667 1.8364 -0.1528 0.1697
3.0000 1.6667 1.8364 1.8657 0.0313 0.0293
4.0000 1.8364 1.8657 1.8607 -0.0007 -0.0050
secantmethod has converged
ans =
1.8607
(c) [-2 -3]
secant(inline('x^3-4*x+1'),-2,-3,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 -2.0000 -3.0000 -2.0667 0.4397 0.9333
2.0000 -3.0000 -2.0667 -2.0951 0.1842 -0.0284
3.0000 -2.0667 -2.0951 -2.1156 -0.0063 -0.0205
4.0000 -2.0951 -2.1156 -2.1149 0.0001 0.0007
secantmethod has converged
ans =
-2.1149
p.2.15
[2 3]
secant(inline('x^3-x^2-4*x-3'),2,3,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 2.0000 3.0000 2.7000 -1.4070 -0.3000
2.0000 3.0000 2.7000 2.7958 -0.1466 0.0958
3.0000 2.7000 2.7958 2.8069 0.0087 0.0111
4.0000 2.7958 2.8069 2.8063 -0.0000 -0.0006
secantmethod has converged
ans =
2.8063
p.2.16
[0 1]
secant(inline('x^3-6*x^2+11*x-5'),0,1,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 0 1.0000 0.8333 0.5787 -0.1667
2.0000 1.0000 0.8333 0.6044 -0.3226 -0.2289
3.0000 0.8333 0.6044 0.6863 0.0467 0.0819
4.0000 0.6044 0.6863 0.6760 0.0030 -0.0104
secantmethod has converged
ans =
0.6760
p.2.17
(a) [ 1 2]
secant(inline('6*x^3-23*x^2+20*x'),1,2,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 1.0000 2.0000 1.4286 -0.8746 -0.5714
2.0000 2.0000 1.4286 1.2687 0.6062 -0.1599
3.0000 1.4286 1.2687 1.3341 -0.0073 0.0655
4.0000 1.2687 1.3341 1.3333 -0.0000 -0.0008
secantmethod has converged
ans =
1.3333
(b) [2 3]
Secant(inline('6*x^3-23*x^2+20*x'),2,3,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 2.0000 3.0000 2.2105 -3.3678 -0.7895
2.0000 3.0000 2.2105 2.3553 -2.0900 0.1448
3.0000 2.2105 2.3553 2.5920 1.8018 0.2368
4.0000 2.3553 2.5920 2.4824 -0.3007 -0.1096
5.0000 2.5920 2.4824 2.4981 -0.0330 0.0157
6.0000 2.4824 2.4981 2.5000 0.0007 0.0019
secantmethod has converged
ans =
2.5000
p.2.18
(a) [2 3]
secant(inline('3*x^3-x^2-18*x+6'),2,3,0.005,8)
step x(k-1) x(k) x (k+1) y(k+1) dx(k+1)
1.0000 2.0000 3.0000 2.2941 -4.3354 -0.7059
2.0000 3.0000 2.2941 2.4021 -1.4263 0.1080
3.0000 2.2941 2.4021 2.4551 0.1743 0.0530
4.0000 2.4021 2.4551 2.4493 -0.0057 -0.0058
5.0000 2.4551 2.4493 2.4495 -0.0000 0.0002
secantmethod has converged
ans =
2.4495
(b) [-2 -3]
secant(inline('3*x^3-x^2-18*x+6'),-2,-3,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 -2.0000 -3.0000 -2.3182 4.9798 0.6818
2.0000 -3.0000 -2.3182 -2.4152 1.3736 -0.0971
3.0000 -2.3182 -2.4152 -2.4522 -0.1118 -0.0370
4.0000 -2.4152 -2.4522 -2.4494 0.0022 0.0028
secantmethod has converged
ans =
-2.4494
(c) [0 1]
secant(inline('3*x^3-x^2-18*x+6'),0,1,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 0 1.0000 0.3750 -0.7324 -0.6250
2.0000 1.0000 0.3750 0.3256 0.1366 -0.0494
3.0000 0.3750 0.3256 0.3334 -0.0007 0.0078
secantmethod has converged
ans =
0.3334
p.2.19
(a) [-1 -2]
secant(inline('x^3-x^2-24*x-32'),-1,-2,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 -1.0000 -2.0000 -1.7143 1.1662 0.2857
2.0000 -2.0000 -1.7143 -1.5967 -0.2993 0.1176
3.0000 -1.7143 -1.5967 -1.6207 0.0133 -0.0240
4.0000 -1.5967 -1.6207 -1.6197 0.0001 0.0010
secantmethod has converged
ans =
-1.6197
(b) [5 6]
secant(inline('x^3-x^2-24*x-32'),5,6,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 5.0000 6.0000 5.9286 -1.0565 -0.0714
2.0000 6.0000 5.9286 5.9435 -0.0142 0.0149
3.0000 5.9286 5.9435 5.9437 0.0001 0.0002
secantmethod has converged
ans =
5.9437
(c) [-3 -4]
secant(inline('x^3-x^2-24*x-32'),-3,-4,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 -3.0000 -4.0000 -3.2000 1.7920 0.8000
2.0000 -4.0000 -3.2000 -3.2806 0.6655 -0.0806
3.0000 -3.2000 -3.2806 -3.3282 -0.0659 -0.0476
4.0000 -3.2806 -3.3282 -3.3239 0.0020 0.0043
secantmethod has converged
ans =
-3.3239
p.2.20
(a) [-3 -4]
secant(inline('x^3-7*x^2+14*x-7'),-3,-4,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 -3.0000 -4.0000 -1.6100 -51.8580 2.3900
2.0000 -4.0000 -1.6100 -0.9477 -27.4065 0.6623
3.0000 -1.6100 -0.9477 -0.2054 -10.1796 0.7423
4.0000 -0.9477 -0.2054 0.2332 -4.1027 0.4386
5.0000 -0.2054 0.2332 0.5294 -1.4020 0.2961
6.0000 0.2332 0.5294 0.6831 -0.3841 0.1537
7.0000 0.5294 0.6831 0.7411 -0.0620 0.0580
ans =
0.7411
(b) [3 4]
secant(inline('x^3-7*x^2+14*x-7'),3,4,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 3.0000 4.0000 3.5000 -0.8750 -0.5000
2.0000 4.0000 3.5000 3.7333 -0.2634 0.2333
3.0000 3.5000 3.7333 3.8338 0.1364 0.1005
4.0000 3.7333 3.8338 3.7995 -0.0099 -0.0343
5.0000 3.8338 3.7995 3.8019 -0.0003 0.0023
secantmethod has converged
ans =
3.8019
(c) [0 1]
>> secant(inline('x^3-7*x^2+14*x-7'),0,1,0.005,8)
step x(k-1) x(k) x(k+1) y(k+1) dx(k+1)
1.0000 0 1.0000 0.8750 0.5605 -0.1250
2.0000 1.0000 0.8750 0.7156 -0.2000 -0.1594
3.0000 0.8750 0.7156 0.7575 0.0229 0.0419
4.0000 0.7156 0.7575 0.7532 0.0008 -0.0043
secantmethod has converged
ans =
0.7532
REGULA FALSI METHOD
Falsi method
Q1
[s,y]=falsi(inline('x^2-2'),1,2,0.005,5)
step a b s y
1.0000 1.0000 2.0000 1.3333 -0.2222
2.0000 1.3333 2.0000 1.4000 -0.0400
3.0000 1.4000 2.0000 1.4118 -0.0069
4.0000 1.4118 2.0000 1.4138 -0.0012
regulafalsi methodhasconverged
s =
1.4138
y =
-0.0012
Q2.
[s,y]=falsi(inline('x^2-5'),2,3,0.005,5)
step a b s y
1.0000 2.0000 3.0000 2.2000 -0.1600
2.0000 2.2000 3.0000 2.2308 -0.0237
3.0000 2.2308 3.0000 2.2353 -0.0035
regulafalsi methodhasconverged
s =
2.2353
y =
-0.0035
Q3
>> [s,y]=falsi(inline('x^2-7'),2,3,0.005,5)
step a b s y
1.0000 2.0000 3.0000 2.6000 -0.2400
2.0000 2.6000 3.0000 2.6429 -0.0153
3.0000 2.6429 3.0000 2.6456 -0.0010
regulafalsi methodhasconverged
s =
2.6456
y =
-9.6138e-004
Q4
>> [s,y]=falsi(inline('x^3-3'),1,2,0.005,5)
step a b s y
1.0000 1.0000 2.0000 1.2857 -0.8746
2.0000 1.2857 2.0000 1.3921 -0.3024
3.0000 1.3921 2.0000 1.4267 -0.0958
4.0000 1.4267 2.0000 1.4375 -0.0295
5.0000 1.4375 2.0000 1.4408 -0.0090
ZERO NOT FOUND TO DESIRED TOLERANCE
s =
1.4408
y =
-0.0090
Q5
>> [s,y]=falsi(inline('x^3-4'),1,2,0.005,5)
step a b s y
1.0000 1.0000 2.0000 1.4286 -1.0845
2.0000 1.4286 2.0000 1.5505 -0.2728
3.0000 1.5505 2.0000 1.5792 -0.0620
4.0000 1.5792 2.0000 1.5856 -0.0137
5.0000 1.5856 2.0000 1.5870 -0.0030
regulafalsi methodhasconverged
s =
1.5870
y =
-0.0030
Q6
>> [s,y]=falsi(inline('x^3-6'),1,2,0.005,5)
step a b s y
1.0000 1.0000 2.0000 1.7143 -0.9621
2.0000 1.7143 2.0000 1.8071 -0.0988
3.0000 1.8071 2.0000 1.8162 -0.0094
4.0000 1.8162 2.0000 1.8170 -0.0009
regulafalsi methodhasconverged
s =
1.8170
y =
-8.8557e-004
Q7
>> [s,y]=falsi(inline('x^4-0.45'),0,1,0.005,5)
step a b s y
1.0000 0 1.0000 0.4500 -0.4090
2.0000 0.4500 1.0000 0.6846 -0.2304
3.0000 0.6846 1.0000 0.7777 -0.0842
4.0000 0.7777 1.0000 0.8072 -0.0254
5.0000 0.8072 1.0000 0.8157 -0.0072
ZERO NOT FOUND TO DESIRED TOLERANCE
s =
0.8157
y =
-0.0072
Q8
>> [s,y]=falsi(inline('x^4-0.65'),0,1,0.005,5)
step a b s y
1.0000 0 1.0000 0.6500 -0.4715
2.0000 0.6500 1.0000 0.8509 -0.1258
3.0000 0.8509 1.0000 0.8903 -0.0217
4.0000 0.8903 1.0000 0.8967 -0.0034
regulafalsi methodhasconverged
s =
0.8967
y =
-0.0034
Q9
>> [s,y]=falsi(inline('x^4-0.06'),0,1,0.005,5)
step a b s y
1.0000 0 1.0000 0.0600 -0.0600
2.0000 0.0600 1.0000 0.1164 -0.0598
3.0000 0.1164 1.0000 0.1693 -0.0592
4.0000 0.1693 1.0000 0.2185 -0.0577
5.0000 0.2185 1.0000 0.2637 -0.0552
ZERO NOT FOUND TO DESIRED TOLERANCE
s =
0.2637
y =
-0.0552
Q10
>> [s,y]=falsi(inline('x^4-0.25'),0,1,0.005,5)
step a b s y
1.0000 0 1.0000 0.2500 -0.2461
2.0000 0.2500 1.0000 0.4353 -0.2141
3.0000 0.4353 1.0000 0.5607 -0.1512
4.0000 0.5607 1.0000 0.6344 -0.0880
5.0000 0.6344 1.0000 0.6728 -0.0451
ZERO NOT FOUND TO DESIRED TOLERANCE
s =
0.6728
y =
-0.0451
Q11
[s,y]=falsi(inline('x^3-9*x+2'),0,1,0.005,8)
step a b s y
1.0000 0 1.0000 0.2500 -0.2344
2.0000 0 0.2500 0.2238 -0.0028
regulafalsi methodhasconverged
s =
0.2238
y =
-0.0028
>> [s,y]=falsi(inline('x^3-9*x+2'),-3,-4,0.005,8)
step a b s y
1.0000 -3.0000 -4.0000 -3.0714 0.6680
2.0000 -3.0714 -4.0000 -3.0947 0.2141
3.0000 -3.0947 -4.0000 -3.1021 0.0677
4.0000 -3.1021 -4.0000 -3.1044 0.0213
5.0000 -3.1044 -4.0000 -3.1051 0.0067
6.0000 -3.1051 -4.0000 -3.1054 0.0021
regulafalsi methodhasconverged
s =
-3.1054
y =
0.0021
>> [s,y]=falsi(inline('x^3-9*x+2'),2,3,0.005,8)
step a b s y
1.0000 2.0000 3.0000 2.8000 -1.2480
2.0000 2.8000 3.0000 2.8768 -0.0821
3.0000 2.8768 3.0000 2.8817 -0.0050
4.0000 2.8817 3.0000 2.8820 -0.0003
regulafalsi methodhasconverged
s =
2.8820
y =
-3.0703e-004
Q12
>> [s,y]=falsi(inline('x^3-2*x^2-5'),2,3,0.005,8)
step a b s y
1.0000 2.0000 3.0000 2.5556 -1.3717
2.0000 2.5556 3.0000 2.6691 -0.2338
3.0000 2.6691 3.0000 2.6873 -0.0363
4.0000 2.6873 3.0000 2.6901 -0.0056
5.0000 2.6901 3.0000 2.6906 -0.0008
regulafalsi methodhasconverged
s =
2.6906
y =
-8.4925e-004
>> [s,y]=falsi(inline('x^3-3*x^2-1'),0,1,0.005,8)
??? Error using==> falsi at 5
functionhassame signat endpoints
>> [s,y]=falsi(inline('x^3+3*x^2-1'),0,1,0.005,8)
step a b s y
1.0000 0 1.0000 0.2500 -0.7969
2.0000 0.2500 1.0000 0.4074 -0.4344
3.0000 0.4074 1.0000 0.4824 -0.1897
4.0000 0.4824 1.0000 0.5132 -0.0749
5.0000 0.5132 1.0000 0.5250 -0.0284
6.0000 0.5250 1.0000 0.5295 -0.0106
7.0000 0.5295 1.0000 0.5311 -0.0039
regulafalsi methodhasconverged
s =
0.5311
y =
-0.0039
>> [s,y]=falsi(inline('x^3+3*x^2-1'),-1,0,0.005,8)
step a b s y
1.0000 -1.0000 0 -0.5000 -0.3750
2.0000 -1.0000 -0.5000 -0.6364 -0.0428
3.0000 -1.0000 -0.6364 -0.6513 -0.0037
regulafalsi methodhasconverged
s =
-0.6513
y =
-0.0037
>> [s,y]=falsi(inline('x^3+3*x^2-1'),-2,-3,0.005,8)
step a b s y
1.0000 -2.0000 -3.0000 -2.7500 0.8906
2.0000 -2.7500 -3.0000 -2.8678 0.0875
3.0000 -2.8678 -3.0000 -2.8784 0.0074
4.0000 -2.8784 -3.0000 -2.8793 0.0006
regulafalsi methodhasconverged
s =
-2.8793
y =
6.2341e-004
>> [s,y]=falsi(inline('x^3-4*x+1'),0,1,0.005,8)
step a b s y
1.0000 0 1.0000 0.3333 -0.2963
2.0000 0 0.3333 0.2571 -0.0116
3.0000 0 0.2571 0.2542 -0.0004
regulafalsi methodhasconverged
s =
0.2542
y =
-3.8225e-004
>> [s,y]=falsi(inline('x^3-4*x+1'),1,2,0.005,8)
step a b s y
1.0000 1.0000 2.0000 1.6667 -1.0370
2.0000 1.6667 2.0000 1.8364 -0.1528
3.0000 1.8364 2.0000 1.8581 -0.0175
4.0000 1.8581 2.0000 1.8605 -0.0020
regulafalsi methodhas converged
s =
1.8605
y =
-0.0020
>> [s,y]=falsi(inline('x^3-4*x+1'),-2,-3,0.005,8)
step a b s y
1.0000 -2.0000 -3.0000 -2.0667 0.4397
2.0000 -2.0667 -3.0000 -2.0951 0.1842
3.0000 -2.0951 -3.0000 -2.1068 0.0756
4.0000 -2.1068 -3.0000 -2.1116 0.0308
5.0000 -2.1116 -3.0000 -2.1136 0.0125
6.0000 -2.1136 -3.0000 -2.1144 0.0051
7.0000 -2.1144 -3.0000 -2.1147 0.0020
regulafalsi methodhasconverged
s =
-2.1147
y =
0.0020
>> [s,y]=falsi(inline('x^3-x^2-4*x-3'),2,3,0.005,8)
step a b s y
1.0000 2.0000 3.0000 2.7000 -1.4070
2.0000 2.7000 3.0000 2.7958 -0.1466
3.0000 2.7958 3.0000 2.8053 -0.0141
4.0000 2.8053 3.0000 2.8062 -0.0013
regulafalsi methodhasconverged
s =
2.8062
y =
-0.0013
>> [s,y]=falsi(inline('x^3-6*x^2+11*x-5'),2,3,0.005,8)
??? Error using==> falsi at 5
functionhassame signat endpoints
>> [s,y]=falsi(inline('x^3-6*x^2+11*x-5'),0,1,0.005,8)
step a b s y
1.0000 0 1.0000 0.8333 0.5787
2.0000 0 0.8333 0.7469 0.2854
3.0000 0 0.7469 0.7066 0.1295
4.0000 0 0.7066 0.6887 0.0566
5.0000 0 0.6887 0.6810 0.0243
6.0000 0 0.6810 0.6777 0.0104
7.0000 0 0.6777 0.6763 0.0044
regulafalsi methodhasconverged
s =
0.6763
y =
0.0044
>> [s,y]=falsi(inline('6*x^3-23*x^2+20*x'),1,2,0.005,8)
step a b s y
1.0000 1.0000 2.0000 1.4286 -0.8746
2.0000 1.0000 1.4286 1.3318 0.0140
3.0000 1.3318 1.4286 1.3334 -0.0002
regulafalsi methodhasconverged
s =
1.3334
y =
-2.2752e-004
>> [s,y]=falsi(inline('6*x^3-23*x^2+20*x'),2,3,0.005,8)
step a b s y
1.0000 2.0000 3.0000 2.2105 -3.3678
2.0000 2.2105 3.0000 2.3553 -2.0900
3.0000 2.3553 3.0000 2.4341 -1.0590
4.0000 2.4341 3.0000 2.4714 -0.4819
5.0000 2.4714 3.0000 2.4879 -0.2086
6.0000 2.4879 3.0000 2.4949 -0.0883
7.0000 2.4949 3.0000 2.4979 -0.0370
8.0000 2.4979 3.0000 2.4991 -0.0155
ZERO NOT FOUND TO DESIRED TOLERANCE
s =
2.4991
y =
-0.0155
>> [s,y]=falsi(inline('3*x^3-x^2+18*x+6'),0,1,0.005,8)
??? Error using==> falsi at 5
functionhassame signat endpoints
>> [s,y]=falsi(inline('3*x^3-x^2-18*x+6'),0,1,0.005,8)
step a b s y
1.0000 0 1.0000 0.3750 -0.7324
2.0000 0 0.3750 0.3342 -0.0154
3.0000 0 0.3342 0.3333 -0.0003
regulafalsi methodhasconverged
s =
0.3333
y =
-2.8549e-004
>> [s,y]=falsi(inline('3*x^3-x^2-18*x+6'),2,3,0.005,8)
step a b s y
1.0000 2.0000 3.0000 2.2941 -4.3354
2.0000 2.2941 3.0000 2.4021 -1.4263
3.0000 2.4021 3.0000 2.4357 -0.4261
4.0000 2.4357 3.0000 2.4455 -0.1236
5.0000 2.4455 3.0000 2.4483 -0.0356
6.0000 2.4483 3.0000 2.4492 -0.0102
7.0000 2.4492 3.0000 2.4494 -0.0029
regulafalsi methodhasconverged
s =
2.4494
y =
-0.0029
>> [s,y]=falsi(inline('3*x^3-x^2-18*x+6'),-2,-3,0.005,8)
step a b s y
1.0000 -2.0000 -3.0000 -2.3182 4.9798
2.0000 -2.3182 -3.0000 -2.4152 1.3736
3.0000 -2.4152 -3.0000 -2.4408 0.3517
4.0000 -2.4408 -3.0000 -2.4473 0.0883
5.0000 -2.4473 -3.0000 -2.4489 0.0221
6.0000 -2.4489 -3.0000 -2.4494 0.0055
7.0000 -2.4494 -3.0000 -2.4495 0.0014
regulafalsi methodhasconverged
s =
-2.4495
y =
0.0014
>> [s,y]=falsi(inline('x^3-x^2-24*x-32'),-1,-2,0.005,8)
step a b s y
1.0000 -1.0000 -2.0000 -1.7143 1.1662
2.0000 -1.0000 -1.7143 -1.6397 0.2555
3.0000 -1.0000 -1.6397 -1.6238 0.0523
4.0000 -1.0000 -1.6238 -1.6205 0.0106
5.0000 -1.0000 -1.6205 -1.6198 0.0021
regulafalsi methodhasconverged
s =
-1.6198
y =
0.0021
>> [s,y]=falsi(inline('x^3-x^2-24*x-32'),5,6,0.005,8)
step a b s y
1.0000 5.0000 6.0000 5.9286 -1.0565
2.0000 5.9286 6.0000 5.9435 -0.0142
3.0000 5.9435 6.0000 5.9437 -0.0002
regulafalsi methodhasconverged
s =
5.9437
y =
-1.9042e-004
>> [s,y]=falsi(inline('x^3-x^2-24*x-32'),-3,-4,0.005,8)
step a b s y
1.0000 -3.0000 -4.0000 -3.2000 1.7920
2.0000 -3.2000 -4.0000 -3.2806 0.6655
3.0000 -3.2806 -4.0000 -3.3093 0.2300
4.0000 -3.3093 -4.0000 -3.3191 0.0775
5.0000 -3.3191 -4.0000 -3.3224 0.0259
6.0000 -3.3224 -4.0000 -3.3235 0.0086
7.0000 -3.3235 -4.0000 -3.3238 0.0029
regulafalsi methodhasconverged
s =
-3.3238
y =
0.0029
>> [s,y]=falsi(inline('x^3-7*x^2+14*x-7'),0,1,0.005,8)
step a b s y
1.0000 0 1.0000 0.8750 0.5605
2.0000 0 0.8750 0.8101 0.2793
3.0000 0 0.8101 0.7790 0.1310
4.0000 0 0.7790 0.7647 0.0597
5.0000 0 0.7647 0.7583 0.0269
6.0000 0 0.7583 0.7554 0.0120
7.0000 0 0.7554 0.7541 0.0054
8.0000 0 0.7541 0.7535 0.0024
regulafalsi methodhasconverged
s =
0.7535
y =
0.0024
>> [s,y]=falsi(inline('x^3-7*x^2+14*x-7'),3,4,0.005,8)
step a b s y
1.0000 3.0000 4.0000 3.5000 -0.8750
2.0000 3.5000 4.0000 3.7333 -0.2634
3.0000 3.7333 4.0000 3.7889 -0.0531
4.0000 3.7889 4.0000 3.7996 -0.0098
5.0000 3.7996 4.0000 3.8015 -0.0018
regulafalsi methodhasconverged
s =
3.8015
y =
-0.0018
THOMAS METHOD
a=[2,4,3,0]
a =
2 4 3 0
>> b=[0,2,1,2]
b =
0 2 1 2
>> d=[2,4,3,5]
d =
2 4 3 5
>> r=[4,6,7,10]
r =
4 6 7 10
>> x=thomas(a,d,b,r)
x =
1 1 0 2
>>
x =
10.0000 -5.8000 2.2000
Question1
>> a=[2,3,0]
a =
2 3 0
>> b=[0,1,3]
b =
0 1 3
>> d=[1,3,10]
d =
1 3 10
>> x=thomas(a,d,b,r)
x =
2 4 1
Question3.22
d=[-2,-2,-2,-2]
d =
-2 -2 -2 -2
>> b=[0,1,1,1]
b =
0 1 1 1
>> a=[1,1,1,0]
a =
1 1 1 0
>> r=[-1,0,0,0]
r =
-1 0 0 0
>> x=thomas(a,d,b,r)
x =
0.8000 0.6000 0.4000 0.2000
>>
r=[33,26,30,15]
question3.23
r =
33 26 30 15
>> d=[5,5,5,5]
d =
5 5 5 5
>> a=[1,1,1,0]
a =
1 1 1 0
>> b=[0,1,1,1]
b =
0 1 1 1
>> x=thomas(a,d,b,r)
x =
6.0000 3.0000 5.0000 2.0000
>>
Question3.24
r=[14;-36;-6;14;-9;6]
r =
14
-36
-6
14
-9
6
>> d=[-3,4,-1,4,1,2]
d =
-3 4 -1 4 1 2
>> a=[-4,5,-3,-5,-5,0]
a =
-4 5 -3 -5 -5 0
>> b=[0,-3,1,0,3,-1]
b =
0 -3 1 0 3 -1
>> x=thomas(a,d,b,r)
x =
2.0000 -5.0000 -2.0000 1.0000 -2.0000 2.0000
>>
Question3.25
b=[0,5,5,2,5,1,-2]
b =
0 5 5 2 5 1 -2
>> a=[3,-1,-1,1,-1,0,0]
a =
3 -1 -1 1 -1 0 0
>> d=[1,-4,-2,3,-3,-1,4]
d =
1 -4 -2 3 -3 -1 4
>> r=[19;1;28;0;-25;0;2]
r =
19
1
28
0
-25
0
2
>> x=thomas(a,d,b,r)
x =
4.0000 5.0000 -1.0000 -1.0000 5.0000 5.0000 3.0000
C3.1
d=[-1,4,1,-1,-2,-2,4,2]
d =
-1 4 1 -1 -2 -2 4 2
b=[0,-1,4,0,-2,-4,2,0]
b =
0 -1 4 0 -2 -4 2 0
>> a=[1,1,3,-2,-2,-2,0,0]
a =
1 1 3 -2 -2 -2 0 0
>> r=[7,13,-3,-2,-4,-28,26,10]
r =
7 13 -3 -2 -4 -28 26 10
>> x=thomas(a,d,b,r)
x =
-4.0000 3.0000 -3.0000 -4.0000 3.0000 3.0000 5.0000 5.0000
>>
questionc3.2
r=[-1;19;20;-1;-19;14;0;-4;-2]
r =
-1
19
20
-1
-19
14
0
-4
-2
>> a=[1,1,-1,4,5,0,-4,-4,0]
a =
1 1 -1 4 5 0 -4 -4 0
>> b=[0,2,3,-4,3,-1,-5,-2,-4]
b =
0 2 3 -4 3 -1 -5 -2 -4
>> d=[-1,3,-3,3,3,-5,1,2,2]
d =
-1 3 -3 3 3 -5 1 2 2
>> x=thomas(a,d,b,r)
x =
5.0000 4.0000 -3.0000 1.0000 -4.0000 -2.0000 -2.0000 2.0000 3.0000
Questionc3.3
d=[3,3,1,-4,0,-3,0,0,0,1]
d =
3 3 1 -4 0 -3 0 0 0 1
>> a=[-4,5,2,5,-2,-2,-5,-1,1,0]
a =
-4 5 2 5 -2 -2 -5 -1 1 0
>> b=[0,3,-1,-2,1,5,1,-3,-3,-4]
b =
0 3 -1 -2 1 5 1 -3 -3 -4
>> r=[-13,-11,-6,25,6,29,1,0,3,-12]
r =
-13 -11 -6 25 6 29 1 0 3 -12
>> x=thomas(a,d,b,r)
x =
Columns1 through9
-3.0000 1.0000 -1.0000 -2.0000 3.0000 -4.0000 -1.0000 -1.0000 3.0000
Column10
-0.0000
>>questiona3.7
a=[1,1,1,1,1,1,0]
a =
1 1 1 1 1 1 0
>> b=[0,1,1,1,1,1,1]
b =
0 1 1 1 1 1 1
>> d=[4,4,4,4,4,4,4]
d =
4 4 4 4 4 4 4
>> r=[7.2,11.82,12,0,-12,-11.82,-7.2]
r =
7.2000 11.8200 12.0000 0 -12.0000 -11.8200 -7.2000
>> x=thomas(a,d,b,r)
x =
1.2986 2.0057 2.4986 0.0000 -2.4986 -2.0057 -1.2986
>>
Questiona3.8
d=[-1.99,-1.99,-1.99,-1.99,-1.99,-1.99,-1.99,-1.99,-1.99]
d =
-1.9900 -1.9900 -1.9900 -1.9900 -1.9900 -1.9900 -1.9900 -1.9900 -1.9900
>> a=[1,1,1,1,1,1,1,1,0]
a =
1 1 1 1 1 1 1 1 0
>> b=[0,1,1,1,1,1,1,1,1]
b =
0 1 1 1 1 1 1 1 1
>> r=[-0.99;0.002;0.0031;0.0042;0.0055;0.0068;0.0084;0.0103;-0.6874]
r =
-0.9900
0.0020
0.0031
0.0042
0.0055
0.0068
0.0084
0.0103
-0.6874
>> x=thomas(a,d,b,r)
x =
0.9846 0.9694 0.9465 0.9172 0.8830 0.8454 0.8061 0.7672 0.7310
GAUSS SEIDEL METHOD
Q P6.1
a=[10 -2 1;
-2 10 -2;
-2 -5 10]
a =
10 -2 1
-2 10 -2
-2 -5 10
>> b=[9;12;18]
b =
9
12
18
>> x0=[0;0;0]
x0 =
0
0
0
>> tol=0.0001
tol =
1.0000e-004
>> max_it=7
max_it=
7
>> x=seidel(a,b,x0,tol,max_it)
i x1 x2 x3
1.0000 0.9000 1.3800 2.6700
2.0000 0.9090 1.9158 2.9397
3.0000 0.9892 1.9858 2.9907
4.0000 0.9981 1.9978 2.9985
5.0000 0.9997 1.9996 2.9998
6.0000 1.0000 1.9999 3.0000
gaussseidel methodconverged
x =
1.0000
2.0000
3.0000
>>
P6.2
max_it=7
max_it=
7
>> tol=0.0001
tol =
1.0000e-004
>> x0=[0;0;0]
x0 =
0
0
0
>> b=[8;4;12]
b =
8
4
12
>> a=[8 1 -1;-1 7 -2;2 1 9]
a =
8 1 -1
-1 7 -2
2 1 9
>> x=seidel(a,b,x0,tol,max_it)
i x1 x2 x3
1.0000 1.0000 0.7143 1.0317
2.0000 1.0397 1.0147 0.9895
3.0000 0.9969 0.9966 1.0011
4.0000 1.0006 1.0004 0.9998
5.0000 0.9999 0.9999 1.0000
6.0000 1.0000 1.0000 1.0000
gaussseidel methodconverged
x =
1.0000
1.0000
1.0000
>>
P6.3
a=[5 -1 0;-1 5 -1;0 -1 5]
a =
5 -1 0
-1 5 -1
0 -1 5
>> b=[9;4;-6]
b =
9
4
-6
>> x0=[0;0;0]
x0 =
0
0
0
>> tol=0.0001
tol =
1.0000e-004
>> max_it=7
max_it=
7
>> x=seidel(a,b,x0,tol,max_it)
i x1 x2 x3
1.0000 1.8000 1.1600 -0.9680
2.0000 2.0320 1.0128 -0.9974
3.0000 2.0026 1.0010 -0.9998
4.0000 2.0002 1.0001 -1.0000
5.0000 2.0000 1.0000 -1.0000
gaussseidel methodconverged
x =
2.0000
1.0000
-1.0000
>>
P6.4
max_it=7
max_it=
7
>> tol=0.0001
tol =
1.0000e-004
>> x0=[0;0;0]
x0 =
0
0
0
>> b=[3;-4;5]
b =
3
-4
5
>> a=[4 1 0;1 3 -1;1 0 2]
a =
4 1 0
1 3 -1
1 0 2
>> x=seidel(a,b,x0,tol,max_it)
i x1 x2 x3
1.0000 0.7500 -1.5833 2.1250
2.0000 1.1458 -1.0069 1.9271
3.0000 1.0017 -1.0249 1.9991
4.0000 1.0062 -1.0024 1.9969
5.0000 1.0006 -1.0012 1.9997
6.0000 1.0003 -1.0002 1.9998
7.0000 1.0001 -1.0001 2.0000
gaussseidel methoddidnotconverged
x =
1.0001
-1.0001
2.0000
>>
P6.5
a=[4 1 0;1 3 -1;0 -1 4]
a =
4 1 0
1 3 -1
0 -1 4
>> b=[3;4;5]
b =
3
4
5
>> x0=[0;0;0]
x0 =
0
0
0
>> tol=0.0001
tol =
1.0000e-004
>> max_it=7
max_it=
7
>> x=seidel(a,b,x0,tol,max_it)
i x1 x2 x3
1.0000 0.7500 1.0833 1.5208
2.0000 0.4792 1.6806 1.6701
3.0000 0.3299 1.7801 1.6950
4.0000 0.3050 1.7967 1.6992
5.0000 0.3008 1.7994 1.6999
6.0000 0.3001 1.7999 1.7000
7.0000 0.3000 1.8000 1.7000
gaussseidel methoddidnotconverged
x =
0.3000
1.8000
1.7000
>>
P6.6
x0=[0;0;0;0]
x0 =
0
0
0
0
max_it=7
max_it=
7
a=[-2 1 0 0 ;
1 -2 1 0;
0 1 -2 1;
0 0 1 -2]
a =
-2 1 0 0
1 -2 1 0
0 1 -2 1
0 0 1 -2
b=[-1;0;0;0]
b =
-1
0
0
0
x=seidel(a,b,x0,tol,max_it)
i x1 x2 x3
1.0000 0.5000 0.2500 0.1250 0.0625
2.0000 0.6250 0.3750 0.2188 0.1094
3.0000 0.6875 0.4531 0.2813 0.1406
4.0000 0.7266 0.5039 0.3223 0.1611
5.0000 0.7520 0.5371 0.3491 0.1746
6.0000 0.7686 0.5588 0.3667 0.1833
7.0000 0.7794 0.5731 0.3782 0.1891
gaussseidel methoddidnotconverged
x =
0.7794
0.5731
0.3782
0.1891
>>
P6.7
max_it=7
max_it=
7
>> x0=[0;0;0;0]
x0 =
0
0
0
0
>> b=[33;26;30;15]
b =
33
26
30
15
a=[5 1 0 0;1 5 1 0;0 1 5 1;0 0 1 5]
a =
5 1 0 0
1 5 1 0
0 1 5 1
0 0 1 5
>> tol=0.0001
tol =
1.0000e-004
>> x=seidel(a,b,x0,tol,max_it)
i x1 x2 x3
1.0000 6.6000 3.8800 5.2240 1.9552
2.0000 5.8240 2.9904 5.0109 1.9978
3.0000 6.0019 2.9974 5.0009 1.9998
4.0000 6.0005 2.9997 5.0001 2.0000
5.0000 6.0001 3.0000 5.0000 2.0000
gaussseidel methodconverged
x =
6.0000
3.0000
5.0000
2.0000
>>
P6.8
a=[1 2 0 0;2 6 8 0;0 8 35 18;0 0 18 112]
a =
1 2 0 0
2 6 8 0
0 8 35 18
0 0 18 112
>> b=[2 ;6;-10;-112]
b =
2
6
-10
-112
tol=0.0001
tol =
1.0000e-004
>> x=seidel(a,b,x0,tol,max_it)
i x1 x2 x3
1.0000 2.0000 0.3333 -0.3619 -0.9418
2.0000 1.3333 1.0381 -0.0386 -0.9938
3.0000 -0.0762 1.0769 -0.0208 -0.9967
4.0000 -0.1538 1.0789 -0.0198 -0.9968
5.0000 -0.1579 1.0790 -0.0197 -0.9968
6.0000 -0.1580 1.0789 -0.0197 -0.9968
7.0000 -0.1578 1.0788 -0.0196 -0.9968
gaussseidel methoddidnotconverged
x =
-0.1578
1.0788
-0.0196
-0.9968
>>
P6.9
b=[-3;5;2;3.5]
b =
-3.0000
5.0000
2.0000
3.5000
>> a=[1 -2 0 0;-2 5 -1 0;0 -1 2 -0.5;0 0 -0.5 1.25]
a =
1.0000 -2.0000 0 0
-2.0000 5.0000 -1.0000 0
0 -1.0000 2.0000 -0.5000
0 0 -0.5000 1.2500
>> x=seidel(a,b,x0,tol,100)
i x1 x2 x3
1.0000 -3.0000 -0.2000 0.9000 3.1600
2.0000 -3.4000 -0.1800 1.7000 3.4800
3.0000 -3.3600 -0.0040 1.8680 3.5472
4.0000 -3.0080 0.1704 1.9720 3.5888
5.0000 -2.6592 0.3307 2.0626 3.6250
6.0000 -2.3386 0.4771 2.1448 3.6579
gaussseidel methodconverged at95th
iteration
x =
0.9991
1.9996
2.9998
3.9999
p.6.10a=[4 -8 0 0;-8 18 -2 0;0 -2 5 -1.5;0 0 -1.5 1.75]
a =
4.0000 -8.0000 0 0
-8.0000 18.0000 -2.0000 0
0 -2.0000 5.0000 -1.5000
0 0 -1.5000 1.7500
>> b=[-12;22;5;2]
b =
-12
22
5
2
>> max_it=7
max_it=
7
>> tol=0.0001
tol =
1.0000e-004
>> x0=[0;0;0;0]
x0 =
0
0
0
0
>> x=seidel(a,b,x0,tol,max_it)
i x1 x2 x3
1.0000 -3.0000 -0.1111 0.9556 1.9619
2.0000 -3.2222 -0.1037 1.5471 2.4689
3.0000 -3.2074 -0.0314 1.7281 2.6241
4.0000 -3.0628 0.0530 1.8084 2.6929
5.0000 -2.8940 0.1369 1.8627 2.7394
6.0000 -2.7261 0.2176 1.9089 2.7790
7.0000 -2.5649 0.2944 1.9515 2.8155
gaussseidel methoddidnotconverged
x =
-2.5649
0.2944
1.9515
2.8155
p.6.11
>> a=[4 8 0 0;8 18 2 0;0 2 5 1.5;0 0 1.5 1.75]
a =
4.0000 8.0000 0 0
8.0000 18.0000 2.0000 0
0 2.0000 5.0000 1.5000
0 0 1.5000 1.7500
>> b=[8;18;0.5;-1.75]
b =
8.0000
18.0000
0.5000
-1.7500
>> tol=0.0001
tol =
1.0000e-004
>> x0=[0;0;0;0]
x0 =
0
0
0
0
>> max_it=7
max_it=
7
>> x=seidel(a,b,x0,tol,max_it)
i x1 x2 x3
1.0000 2.0000 0.1111 0.0556 -1.0476
2.0000 1.7778 0.2037 0.3328 -1.2853
3.0000 1.5926 0.2552 0.3835 -1.3287
4.0000 1.4896 0.2953 0.3805 -1.3261
5.0000 1.4093 0.3314 0.3653 -1.3131
6.0000 1.3373 0.3651 0.3479 -1.2982
7.0000 1.2699 0.3970 0.3307 -1.2834
gaussseidel methoddid notconverged
x =
1.2699
0.3970
0.3307
-1.2834
p.6.12
a=[1 -2 0 0 0;-2 5 1 0 0;0 1 2 -2 0;0 0 -2 5 1;0 0 0 1 2]
a =
1 -2 0 0 0
-2 5 1 0 0
0 1 2 -2 0
0 0 -2 5 1
0 0 0 1 2
>> b=[5;-9;0;3;0]
b =
5
-9
0
3
0
>> x0=[0;0;0;0;0]
x0 =
0
0
0
0
0
>> x=seidel(a,b,x0,tol,max_it)
i x1 x2 x3
1.0000 5.0000 0.2000 -0.1000 0.5600 -0.2800
2.0000 5.4000 0.3800 0.3700 0.8040 -0.4020
3.0000 5.7600 0.4300 0.5890 0.9160 -0.4580
4.0000 5.8600 0.4262 0.7029 0.9728 -0.4864
5.0000 5.8524 0.4004 0.7726 1.0063 -0.5032
6.0000 5.8008 0.3658 0.8234 1.0300 -0.5150
7.0000 5.7316 0.3280 0.8660 1.0494 -0.5247
gaussseidel methoddidnotconverged
x =
5.7316
0.3280
0.8660
1.0494
-0.5247
>>p.6.13>> a=[1 -2 0 0 0;-2 6 4 0 0;0 4 9 -0.5 0;0 0 -0.5 1.25 0.5;0 0 0 0.5 3.25]
a =
1.0000 -2.0000 0 0 0
-2.0000 6.0000 4.0000 0 0
0 4.0000 9.0000 -0.5000 0
0 0 -0.5000 1.2500 0.5000
0 0 0 0.5000 3.2500
>> b=[5;-2;18;0.5;-2.25]
b =
5.0000
-2.0000
18.0000
0.5000
-2.2500
>> max_it=260
max_it=
260
>> x0=[0;0;0;0;0]
x0 =
0
0
0
0
0
>>
>> max_it=1000
max_it=
1000
>> x=seidel(a,b,x0,tol,max_it)
i x1 x2 x3
1.0000 5.0000 1.3333 1.4074 0.9630 -0.8405
2.0000 7.6667 1.2840 1.4829 1.3293 -0.8968
3.0000 7.5679 1.2007 1.5402 1.3748 -0.9038
4.0000 7.4015 1.1070 1.5844 1.3953 -0.9070
5.0000 7.2141 1.0151 1.6264 1.4133 -0.9097
6.0000 7.0302 0.9258 1.6670 1.4307 -0.9124
gaussseidel methodconverged at260th
iteration
x =
1.0028
-1.9986
2.9994
1.9997
-1.0000
p.6.14
> a=[1 -2 0 0 0 0;-2 6 4 0 0 0;0 4 9 -0.5 0 0;0 0 -0.5 3.25 1.5 0;0 0 0 1.5 1.75 -3;0 0 0 0 -3 13]
a =
1.0000 -2.0000 0 0 0 0
-2.0000 6.0000 4.0000 0 0 0
0 4.0000 9.0000 -0.5000 0 0
0 0 -0.5000 3.2500 1.5000 0
0 0 0 1.5000 1.7500 -3.0000
0 0 0 0 -3.0000 13.0000
>> b=[-3;22;35.5;-7.75;4;-33]
b =
-3.0000
22.0000
35.5000
-7.7500
4.0000
-33.0000
>> x0=[0;0;0;0;0;0]
x0 =
0
0
0
0
0
0
>> x=seidel(a,b,x0,tol,300)
i x1 x2 x3
1.0000 -3.0000 2.6667 2.7593 -1.9601 3.9658 -1.6233
2.0000 2.3333 2.6049 2.6778 -3.8030 2.7627 -1.9009
3.0000 2.2099 2.6181 2.5696 -3.2644 1.8250 -2.1173
4.0000 2.2362 2.6990 2.5635 -2.8326 1.0840 -2.2883
5.0000 2.3980 2.7570 2.5618 -2.4908 0.4979 -2.4236
6.0000 2.5140 2.7968 2.5630 -2.2201 0.0339 -2.5306
gaussseidel methodconvergedat234th
iteration
x =
1.0029
2.0014
2.9993
-1.0003
-1.9995
-2.9999
Jacobi method
P.6.1
a=[10 -2 1;-2 10 -2;-2 -5 10]
a =
10 -2 1
-2 10 -2
-2 -5 10
>> b=[9;12;18]
b =
9
12
18
>> xo=[0;0;0]
xo=
0
0
0
>> x=jacobi(a,b,xo,tol,20)
i x1 x2 x3
1.0000 0.9000 1.2000 1.8000
2.0000 0.9600 1.7400 2.5800
3.0000 0.9900 1.9080 2.8620
4.0000 0.9954 1.9704 2.9520
5.0000 0.9989 1.9895 2.9843
6.0000 0.9995 1.9966 2.9945
7.0000 0.9999 1.9988 2.9982
8.0000 0.9999 1.9996 2.9994
9.0000 1.0000 1.9999 2.9998
10.0000 1.0000 2.0000 2.9999
jacobi methodhasconverged
x =
1.0000
2.0000
3.0000
P.6.2
> a=[8 1 -1;-1 7 -2;2 1 9]
a =
8 1 -1
-1 7 -2
2 1 9
>> b=[8;4;12]
b =
8
4
12
>> x=jacobi(a,b,xo,tol,20)
i x1 x2 x3
1.0000 1.0000 0.5714 1.3333
2.0000 1.0952 1.0952 1.0476
3.0000 0.9940 1.0272 0.9683
4.0000 0.9926 0.9901 0.9983
5.0000 1.0010 0.9985 1.0027
6.0000 1.0005 1.0009 0.9999
7.0000 0.9999 1.0001 0.9998
8.0000 1.0000 0.9999 1.0000
jacobi methodhasconverged
x =
1.0000
1.0000
1.0000
>>p6.3
b=[9;4;-6]
b =
9
4
-6
>> a=[5 -1 0;-1 5 -1;0 -1 5]
a =
5 -1 0
-1 5 -1
0 -1 5
>> x=jacobi(a,b,xo,tol,20)
i x1 x2 x3
1.0000 1.8000 0.8000 -1.2000
2.0000 1.9600 0.9200 -1.0400
3.0000 1.9840 0.9840 -1.0160
4.0000 1.9968 0.9936 -1.0032
5.0000 1.9987 0.9987 -1.0013
6.0000 1.9997 0.9995 -1.0003
7.0000 1.9999 0.9999 -1.0001
8.0000 2.0000 1.0000 -1.0000
jacobi methodhasconverged
x =
2.0000
1.0000
-1.0000
>>
>>p6.4
a=[4 1 0;1 3 -1;1 0 2]
a =
4 1 0
1 3 -1
1 0 2
>> b=[3;-4;5]
b =
3
-4
5
>> x=jacobi(a,b,xo,tol,20)
i x1 x2 x3
1.0000 0.7500 -1.3333 2.5000
2.0000 1.0833 -0.7500 2.1250
3.0000 0.9375 -0.9861 1.9583
4.0000 0.9965 -0.9931 2.0313
5.0000 0.9983 -0.9884 2.0017
6.0000 0.9971 -0.9988 2.0009
7.0000 0.9997 -0.9987 2.0014
8.0000 0.9997 -0.9994 2.0001
9.0000 0.9999 -0.9998 2.0002
10.0000 1.0000 -0.9999 2.0001
jacobi methodhasconverged
x =
1.0000
-1.0000
2.0000
>>
P6.5
a=[4 1 0;1 3 -1;0 -1 4]
a =
4 1 0
1 3 -1
0 -1 4
>> b=[3;4;5]
b =
3
4
5
>> x=jacobi(a,b,xo,tol,20)
i x1 x2 x3
1.0000 0.7500 1.3333 1.2500
2.0000 0.4167 1.5000 1.5833
3.0000 0.3750 1.7222 1.6250
4.0000 0.3194 1.7500 1.6806
5.0000 0.3125 1.7870 1.6875
6.0000 0.3032 1.7917 1.6968
7.0000 0.3021 1.7978 1.6979
8.0000 0.3005 1.7986 1.6995
9.0000 0.3003 1.7996 1.6997
10.0000 0.3001 1.7998 1.6999
11.0000 0.3001 1.7999 1.6999
jacobi methodhasconverged
x =
0.3000
1.8000
1.7000
>>
P6.6
b=[-1;0;0;0]
b =
-1
0
0
0
>> a=[-2 1 0 0;1 -2 1 0;0 1 -2 1;0 0 1 -2]
a =
-2 1 0 0
1 -2 1 0
0 1 -2 1
0 0 1 -2
>> x0=[0;0;0;0]
x0 =
0
0
0
0
x=jacobi(a,b,x0,tol,max_it)
i x1 x2 x3 x4
1.0000 0.5000 0 0 0
2.0000 0.5000 0.2500 0 0
3.0000 0.6250 0.2500 0.1250 0
4.0000 0.6250 0.3750 0.1250 0.0625
5.0000 0.6875 0.3750 0.2188 0.0625
6.0000 0.6875 0.4531 0.2188 0.1094
7.0000 0.7266 0.4531 0.2813 0.1094
jacobi methoddidnotconverged
resultaftermax no. of iterations
x =
0.7266
0.4531
0.2813
0.1094
>>
P6.7
=[5 1 0 0;1 5 1 0;0 1 5 1;0 0 1 5]
a =
5 1 0 0
1 5 1 0
0 1 5 1
0 0 1 5
>> b=[33;26;30;15]
b =
33
26
30
15
>> x0=[0;0;0;0]
x0 =
0
0
0
0
x=jacobi(a,b,x0,tol,20)
i x1 x2 x3 x4
1.0000 6.6000 5.2000 6.0000 3.0000
2.0000 5.5600 2.6800 4.3600 1.8000
3.0000 6.0640 3.2160 5.1040 2.1280
4.0000 5.9568 2.9664 4.9312 1.9792
5.0000 6.0067 3.0224 5.0109 2.0138
6.0000 5.9955 2.9965 4.9928 1.9978
7.0000 6.0007 3.0023 5.0011 2.0014
8.0000 5.9995 2.9996 4.9992 1.9998
9.0000 6.0001 3.0002 5.0001 2.0002
jacobi methodhasconverged
x =
6.0000
3.0000
4.9999
2.0000
>>p6.8
a=[1 2 0 0;2 6 8 0;0 8 35 18]
a =
1 2 0 0
2 6 8 0
0 8 35 18
>> b=[2;6;-10;-112]
b =
2
6
-10
-112
>>
x=jacobi(a,b,x0,tol,10)
i x1 x2 x3 x4
1.0000 2.0000 1.0000 -0.2857 -1.0000
2.0000 0 0.7143 0 -0.9541
3.0000 0.5714 1.0000 0.0417 -1.0000
4.0000 0 0.7539 0 -1.0067
5.0000 0.4921 1.0000 0.0597 -1.0000
6.0000 0 0.7564 0 -1.0096
7.0000 0.4873 1.0000 0.0606 -1.0000
8.0000 0 0.7568 0 -1.0097
9.0000 0.4865 1.0000 0.0606 -1.0000
10.0000 0 0.7570 0 -1.0097
jacobi methoddidnotconverged
resultaftermax no. of iterations
x =
0
0.7570
0
-1.0097
P6.9
a=[1 -2 0 0;-2 5 -1 0;0 -1 2 -0.5;0 0 -0.5 1.25]
a =
1.0000 -2.0000 0 0
-2.0000 5.0000 -1.0000 0
0 -1.0000 2.0000 -0.5000
0 0 -0.5000 1.2500
>> b=[-3;5;2;3.5]
b =
-3.0000
5.0000
2.0000
3.5000
>> tol=0.001
tol =
1.0000e-003
>> x0=[0;0;0;0]
x0 =
0
0
0
0
>> x=jacobi(a,b,x0,tol,200)
i x1 x2 x3 x4
1.0000 -3.0000 1.0000 1.0000 2.8000
2.0000 -1.0000 -0.0000 2.2000 3.2000
3.0000 -3.0000 1.0400 1.8000 3.6800
4.0000 -0.9200 0.1600 2.4400 3.5200
5.0000 -2.6800 1.1200 1.9600 3.7760
6.0000 -0.7600 0.3200 2.5040 3.5840
jacobi methodhasconverged at172nd
iteration
x =
0.9983
1.9996
2.9995
3.9999
>>p6.10
a=[4 -8 0 0;-8 18 -2 0;0 -2 5 -1.5;0 0 -1.5 1.75]
a =
4.0000 -8.0000 0 0
-8.0000 18.0000 -2.0000 0
0 -2.0000 5.0000 -1.5000
0 0 -1.5000 1.7500
>> x0=[0;0;0;0]
x0 =
0
0
0
0
>> tol=0.001
tol =
1.0000e-003
>> b=[-12;22;5;2]
b =
-12
22
5
2
x=jacobi(a,b,x0,tol,500)
i x1 x2 x3 x4
1.0000 -3.0000 1.2222 1.0000 1.1429
2.0000 -0.5556 0.0000 1.8317 2.0000
3.0000 -3.0000 1.1788 1.6000 2.7129
4.0000 -0.6423 0.0667 2.2854 2.5143
5.0000 -2.8667 1.1907 1.7810 3.1018
6.0000 -0.6186 0.1460 2.4068 2.6694
jacobi methodhasconverged at310th
iteration
x =
0.4987
1.7498
2.7496
3.4999
>>
P6.11
b=[8;18;0.5;-1.75]
b =
8.0000
18.0000
0.5000
-1.7500
>> tol=0.001
tol =
1.0000e-003
>> x0=[0;0;0;0]
x0 =
0
0
0
0
>> a=[4 8 0 0;8 18 2 0;0 2 5 1.5;0 0 1.5 1.75]
a =
4.0000 8.0000 0 0
8.0000 18.0000 2.0000 0
0 2.0000 5.0000 1.5000
0 0 1.5000 1.7500
>>
x=jacobi(a,b,x0,tol,500)
i x1 x2 x3 x4
1.0000 2.0000 1.0000 0.1000 -1.0000
2.0000 0 0.1000 -0.0000 -1.0857
3.0000 1.8000 1.0000 0.3857 -1.0000
4.0000 0 0.1571 -0.0000 -1.3306
5.0000 1.6857 1.0000 0.4363 -1.0000
6.0000 0 0.2023 -0.0000 -1.3740
jacobi methodhasconverge at 300th
iteration
x =
0.0008
1.0000
0.0002
-1.0000
>>p6.12
a=[1 -2 0 0 0;-2 5 1 0 0;0 1 2 -2 0;0 0 -2 5 1;0 0 0 1 2]
a =
1 -2 0 0 0
-2 5 1 0 0
0 1 2 -2 0
0 0 -2 5 1
0 0 0 1 2
>> b=[5;-9;0;3;0]
b =
5
-9
0
3
0
x=jacobi(a,b,x0,tol,1000)
i x1 x2 x3 x4
1.0000 5.0000 -1.8000 0 0.6000 0
2.0000 1.4000 0.2000 1.5000 0.6000 -0.3000
3.0000 5.4000 -1.5400 0.5000 1.2600 -0.3000
4.0000 1.9200 0.2600 2.0300 0.8600 -0.6300
5.0000 5.5200 -1.4380 0.7300 1.5380 -0.4300
6.0000 2.1240 0.2620 2.2570 0.9780 -0.7690
jacobi methodhasconverged at968th
iteration
x =
1.0011
-1.9998
2.9995
1.9999
-0.9999
p.6.13
>> a=[1 -2 0 0 0;-2 6 4 0 0;0 4 9 -0.5 0;0 0 -0.5 1.25 0.5;0 0 0 0.5 3.25]
a =
1.0000 -2.0000 0 0 0
-2.0000 6.0000 4.0000 0 0
0 4.0000 9.0000 -0.5000 0
0 0 -0.5000 1.2500 0.5000
0 0 0 0.5000 3.2500
>> b=[5;-2;18;0.5;-2.25]
b =
5.0000
-2.0000
18.0000
0.5000
-2.2500.
x=jacobi(a,b,x0,tol,500)
i x1 x2 x3 x4
1.0000 5.0000 -0.3333 2.0000 0.4000 -0.6923
2.0000 4.3333 -0.0000 2.1704 1.4769 -0.7538
3.0000 5.0000 -0.3358 2.0821 1.5697 -0.9195
4.0000 4.3284 -0.0547 2.2365 1.6006 -0.9338
5.0000 4.8906 -0.3815 2.1132 1.6681 -0.9386
6.0000 4.2370 -0.1120 2.2622 1.6207 -0.9489
jacobi methodhasconverged at436th
iteration
x =
1.0059
-1.9975
2.9987
1.9995
-0.9999
>>p6.14
a=[1 -2 0 0 0 0;-2 6 4 0 0 0;0 4 9 -0.5 0 0;0 0 -0.5 3.25 1.5 0;0 0 0 1.5 1.75 -3;0 0 0 0 -3 13]
a =
1.0000 -2.0000 0 0 0 0
-2.0000 6.0000 4.0000 0 0 0
0 4.0000 9.0000 -0.5000 0 0
0 0 -0.5000 3.2500 1.5000 0
0 0 0 1.5000 1.7500 -3.0000
0 0 0 0 -3.0000 13.0000
>> b=[-3;22;35.5;-7.75;4;-33]
b =
-3.0000
22.0000
35.5000
-7.7500
4.0000
-33.0000
>> x0=[0;0;0;0;0;0]
x0 =
0
0
0
0
0
0
>> x=jacobi(a,b,x0,tol,500)
i x1 x2 x3 x4
1.0000 -3.0000 3.6667 3.9444 -2.3846 2.2857 -2.5385
2.0000 4.3333 0.0370 2.1823 -2.8327 -0.0220 -2.0110
3.0000 -2.9259 3.6562 3.7706 -2.0387 1.2664 -2.5435
4.0000 4.3124 0.1776 2.2062 -2.3890 -0.3271 -2.2462
5.0000 -2.6448 3.6334 3.7328 -1.8942 0.4827 -2.6140
6.0000 4.2667 0.2966 2.2244 -2.0331 -0.5717 -2.4271
jacobi methoddidnotconverged
resultaftermax no. of iterations
x =
1.0028
1.9989
2.9994
-0.9997
-1.9995
-3.0001
jacobi methodhasconverged at622nd
iteration
x =
0.9996
2.0002
3.0001
-1.0001
-2.0001
-3.0000
p.6.18
>> a=[10 0 1 0 0 0 0 0;0 10 0 0 0 0 -1 0;0 0 10 0 0 -2 0 0;2 0 0 10 0 0 0 0;0 0 1 0 10 0 0 0;0 0 0 -3 0 10 0 0;0
3 0 0 0 0 10 0;0 0 0 0 1 0 0 10]
a =
10 0 1 0 0 0 0 0
0 10 0 0 0 0 -1 0
0 0 10 0 0 -2 0 0
2 0 0 10 0 0 0 0
0 0 1 0 10 0 0 0
0 0 0 -3 0 10 0 0
0 3 0 0 0 0 10 0
0 0 0 0 1 0 0 10
> b=[13;13;18;42;53;48;76;85]
b =
13
13
18
42
53
48
76
85
>> x0=[0;0;0;0;0;0;0;0]
x0 =
0
0
0
0
0
0
0
0
>> x=jacobi(a,b,x0,tol,1000)
i x1 x2 x3 x4
1.0000 1.3000 1.3000 1.8000 4.2000 5.3000 4.8000 7.6000 8.5000
2.0000 1.1200 2.0600 2.7600 3.9400 5.1200 6.0600 7.2100 7.9700
3.0000 1.0240 2.0210 3.0120 3.9760 5.0240 5.9820 6.9820 7.9880
4.0000 0.9988 1.9982 2.9964 3.9952 4.9988 5.9928 6.9937 7.9976
5.0000 1.0004 1.9994 2.9986 4.0002 5.0004 5.9986 7.0005 8.0001
6.0000 1.0001 2.0001 2.9997 3.9999 5.0001 6.0001 7.0002 8.0000
jacobi methodhasconverged
x =
1.0000
2.0000
3.0000
4.0000
5.0000
6.0000
7.0000
8.0000
Ad

More Related Content

Viewers also liked (8)

Bisection & Regual falsi methods
Bisection & Regual falsi methodsBisection & Regual falsi methods
Bisection & Regual falsi methods
Divya Bhatia
 
MATLAB : Numerical Differention and Integration
MATLAB : Numerical Differention and IntegrationMATLAB : Numerical Differention and Integration
MATLAB : Numerical Differention and Integration
Ainul Islam
 
Es272 ch3a
Es272 ch3aEs272 ch3a
Es272 ch3a
Batuhan Yıldırım
 
Engineering Mathematics-IV_B.Tech_Semester-IV_Unit-III
Engineering Mathematics-IV_B.Tech_Semester-IV_Unit-IIIEngineering Mathematics-IV_B.Tech_Semester-IV_Unit-III
Engineering Mathematics-IV_B.Tech_Semester-IV_Unit-III
Rai University
 
Numerical Methods - Oridnary Differential Equations - 1
Numerical Methods - Oridnary Differential Equations - 1Numerical Methods - Oridnary Differential Equations - 1
Numerical Methods - Oridnary Differential Equations - 1
Dr. Nirav Vyas
 
Numerical method
Numerical methodNumerical method
Numerical method
Kumar Gaurav
 
Finite DIfference Methods Mathematica
Finite DIfference Methods MathematicaFinite DIfference Methods Mathematica
Finite DIfference Methods Mathematica
guest56708a
 
METODOS NUMERICOS para ingenieria -Chapra
METODOS NUMERICOS para ingenieria -ChapraMETODOS NUMERICOS para ingenieria -Chapra
METODOS NUMERICOS para ingenieria -Chapra
Adriana Oleas
 
Bisection & Regual falsi methods
Bisection & Regual falsi methodsBisection & Regual falsi methods
Bisection & Regual falsi methods
Divya Bhatia
 
MATLAB : Numerical Differention and Integration
MATLAB : Numerical Differention and IntegrationMATLAB : Numerical Differention and Integration
MATLAB : Numerical Differention and Integration
Ainul Islam
 
Engineering Mathematics-IV_B.Tech_Semester-IV_Unit-III
Engineering Mathematics-IV_B.Tech_Semester-IV_Unit-IIIEngineering Mathematics-IV_B.Tech_Semester-IV_Unit-III
Engineering Mathematics-IV_B.Tech_Semester-IV_Unit-III
Rai University
 
Numerical Methods - Oridnary Differential Equations - 1
Numerical Methods - Oridnary Differential Equations - 1Numerical Methods - Oridnary Differential Equations - 1
Numerical Methods - Oridnary Differential Equations - 1
Dr. Nirav Vyas
 
Finite DIfference Methods Mathematica
Finite DIfference Methods MathematicaFinite DIfference Methods Mathematica
Finite DIfference Methods Mathematica
guest56708a
 
METODOS NUMERICOS para ingenieria -Chapra
METODOS NUMERICOS para ingenieria -ChapraMETODOS NUMERICOS para ingenieria -Chapra
METODOS NUMERICOS para ingenieria -Chapra
Adriana Oleas
 

Similar to numerical method solutions (20)

Normal dis
Normal disNormal dis
Normal dis
noinasang
 
Normal dis
Normal disNormal dis
Normal dis
noinasang
 
Tabla z
Tabla zTabla z
Tabla z
Ángel Luis Vicentín
 
стандарт хэвийн тархалт
стандарт хэвийн тархалтстандарт хэвийн тархалт
стандарт хэвийн тархалт
Adilbishiin Gelegjamts
 
PCA on Optical images
PCA on Optical imagesPCA on Optical images
PCA on Optical images
alikhosravani
 
Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...
Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...
Analysis of 1st order and 2nd order nonlinear semi rigid connection frame sub...
Salar Delavar Qashqai
 
Estadística descriptiva 1
Estadística descriptiva 1Estadística descriptiva 1
Estadística descriptiva 1
Ian Santillann
 
Copy of z table
Copy of z tableCopy of z table
Copy of z table
Pimsat University
 
Rollway tandem bearings
Rollway   tandem bearingsRollway   tandem bearings
Rollway tandem bearings
Xing-wen Li
 
Prov ca
Prov caProv ca
Prov ca
tkost company
 
Tabel Statistik
Tabel StatistikTabel Statistik
Tabel Statistik
DianMaitesa1
 
Tab calc presentation
Tab calc presentationTab calc presentation
Tab calc presentation
Alexey Mints
 
Tarea 2 hidraulica iii-cabrera arias roberto alejandro
Tarea 2 hidraulica iii-cabrera arias roberto alejandroTarea 2 hidraulica iii-cabrera arias roberto alejandro
Tarea 2 hidraulica iii-cabrera arias roberto alejandro
Alejandro Cabrera
 
NCFM - Normal distribution table options trading (advanced) module (NSE)
NCFM - Normal distribution table   options trading (advanced) module (NSE)NCFM - Normal distribution table   options trading (advanced) module (NSE)
NCFM - Normal distribution table options trading (advanced) module (NSE)
Nimesh Parekh
 
Ztable
ZtableZtable
Ztable
Universitas Negeri Makassar
 
slides36.pptx
slides36.pptxslides36.pptx
slides36.pptx
DarSafwan
 
Change Point Analysis (CPA)
Change Point Analysis (CPA)Change Point Analysis (CPA)
Change Point Analysis (CPA)
Taha Kass-Hout, MD, MS
 
Alan peña histo
Alan peña histoAlan peña histo
Alan peña histo
Alan Peña García
 
Soluciones
SolucionesSoluciones
Soluciones
Andrés Renteria
 
Soluciones
SolucionesSoluciones
Soluciones
Andrés Renteria
 
Ad

More from Sonia Pahuja (11)

raster and random scan
raster and random scanraster and random scan
raster and random scan
Sonia Pahuja
 
Scanfill polygon
Scanfill polygonScanfill polygon
Scanfill polygon
Sonia Pahuja
 
Graphics exercise (b.tech)
Graphics exercise (b.tech)Graphics exercise (b.tech)
Graphics exercise (b.tech)
Sonia Pahuja
 
graphics notes
graphics notesgraphics notes
graphics notes
Sonia Pahuja
 
Graphics exercise (b.tech)
Graphics exercise (b.tech)Graphics exercise (b.tech)
Graphics exercise (b.tech)
Sonia Pahuja
 
Surajkund Mella Faridabad
Surajkund Mella FaridabadSurajkund Mella Faridabad
Surajkund Mella Faridabad
Sonia Pahuja
 
Business Ethics
Business Ethics Business Ethics
Business Ethics
Sonia Pahuja
 
CODE Data Structures
CODE Data StructuresCODE Data Structures
CODE Data Structures
Sonia Pahuja
 
DATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEMDATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEM
Sonia Pahuja
 
Introduction to sets
Introduction to setsIntroduction to sets
Introduction to sets
Sonia Pahuja
 
Data Link Control
Data Link ControlData Link Control
Data Link Control
Sonia Pahuja
 
raster and random scan
raster and random scanraster and random scan
raster and random scan
Sonia Pahuja
 
Graphics exercise (b.tech)
Graphics exercise (b.tech)Graphics exercise (b.tech)
Graphics exercise (b.tech)
Sonia Pahuja
 
Graphics exercise (b.tech)
Graphics exercise (b.tech)Graphics exercise (b.tech)
Graphics exercise (b.tech)
Sonia Pahuja
 
Surajkund Mella Faridabad
Surajkund Mella FaridabadSurajkund Mella Faridabad
Surajkund Mella Faridabad
Sonia Pahuja
 
CODE Data Structures
CODE Data StructuresCODE Data Structures
CODE Data Structures
Sonia Pahuja
 
DATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEMDATABASE MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEM
Sonia Pahuja
 
Introduction to sets
Introduction to setsIntroduction to sets
Introduction to sets
Sonia Pahuja
 
Ad

Recently uploaded (20)

Construction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil EngineeringConstruction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil Engineering
Lavish Kashyap
 
JRR Tolkien’s Lord of the Rings: Was It Influenced by Nordic Mythology, Homer...
JRR Tolkien’s Lord of the Rings: Was It Influenced by Nordic Mythology, Homer...JRR Tolkien’s Lord of the Rings: Was It Influenced by Nordic Mythology, Homer...
JRR Tolkien’s Lord of the Rings: Was It Influenced by Nordic Mythology, Homer...
Reflections on Morality, Philosophy, and History
 
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdf
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdfSmart City is the Future EN - 2024 Thailand Modify V1.0.pdf
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdf
PawachMetharattanara
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
Design of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdfDesign of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdf
Kamel Farid
 
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software ApplicationsJacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia
 
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink DisplayHow to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
CircuitDigest
 
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
ajayrm685
 
hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .
NABLAS株式会社
 
Evonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdfEvonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdf
szhang13
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
Artificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptxArtificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptx
rakshanatarajan005
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
Working with USDOT UTCs: From Conception to Implementation
Working with USDOT UTCs: From Conception to ImplementationWorking with USDOT UTCs: From Conception to Implementation
Working with USDOT UTCs: From Conception to Implementation
Alabama Transportation Assistance Program
 
Uses of drones in civil construction.pdf
Uses of drones in civil construction.pdfUses of drones in civil construction.pdf
Uses of drones in civil construction.pdf
surajsen1729
 
2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt
rakshaiya16
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Journal of Soft Computing in Civil Engineering
 
Construction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil EngineeringConstruction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil Engineering
Lavish Kashyap
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdf
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdfSmart City is the Future EN - 2024 Thailand Modify V1.0.pdf
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdf
PawachMetharattanara
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
Design of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdfDesign of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdf
Kamel Farid
 
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software ApplicationsJacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia
 
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink DisplayHow to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
CircuitDigest
 
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
ajayrm685
 
hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .
NABLAS株式会社
 
Evonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdfEvonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdf
szhang13
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
Artificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptxArtificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptx
rakshanatarajan005
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
Uses of drones in civil construction.pdf
Uses of drones in civil construction.pdfUses of drones in civil construction.pdf
Uses of drones in civil construction.pdf
surajsen1729
 
2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt
rakshaiya16
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 

numerical method solutions

  • 1. Laurence V. Fausett, Applied Numerical Analysis, Using MATLAB, Pearson, BISECTION METHOD p.2.1 [1 2] step a b m ym bound 1.0000 1.0000 2.0000 1.5000 0.2500 0.5000 2.0000 1.0000 1.5000 1.2500 -0.4375 0.2500 3.0000 1.2500 1.5000 1.3750 -0.1094 0.1250 4.0000 1.3750 1.5000 1.4375 0.0664 0.0625 5.0000 1.3750 1.4375 1.4063 -0.0225 0.0313 6.0000 1.4063 1.4375 1.4219 0.0217 0.0156 7.0000 1.4063 1.4219 1.4141 -0.0004 0.0078 zero not foundto desired tolerance p.2.2 [ 2 3] step a b m ym bound 1.0000 2.0000 3.0000 2.5000 1.2500 0.5000 2.0000 2.0000 2.5000 2.2500 0.0625 0.2500 3.0000 2.0000 2.2500 2.1250 -0.4844 0.1250 4.0000 2.1250 2.2500 2.1875 -0.2148 0.0625 5.0000 2.1875 2.2500 2.2188 -0.0771 0.0313 6.0000 2.2188 2.2500 2.2344 -0.0076 0.0156 7.0000 2.2344 2.2500 2.2422 0.0274 0.0078 8.0000 2.2344 2.2422 2.2383 0.0099 0.0039 zero not foundto desiredtolerence p.2.3 [ 2 3] step a b m ym bound 1.0000 2.0000 3.0000 2.5000 -0.7500 0.5000 2.0000 2.5000 3.0000 2.7500 0.5625 0.2500 3.0000 2.5000 2.7500 2.6250 -0.1094 0.1250 4.0000 2.6250 2.7500 2.6875 0.2227 0.0625 5.0000 2.6250 2.6875 2.6563 0.0557 0.0313 6.0000 2.6250 2.6563 2.6406 -0.0271 0.0156 zero not foundto desired tolerance
  • 2. p.2.4 [1 2] step a b m ym bound 1.0000 1.0000 2.0000 1.5000 0.3750 0.5000 2.0000 1.0000 1.5000 1.2500 -1.0469 0.2500 3.0000 1.2500 1.5000 1.3750 -0.4004 0.1250 4.0000 1.3750 1.5000 1.4375 -0.0295 0.0625 5.0000 1.4375 1.5000 1.4688 0.1684 0.0313 6.0000 1.4375 1.4688 1.4531 0.0684 0.0156 7.0000 1.4375 1.4531 1.4453 0.0192 0.0078 8.0000 1.4375 1.4453 1.4414 -0.0053 0.0039 9.0000 1.4414 1.4453 1.4434 0.0069 0.0020 10.0000 1.4414 1.4434 1.4424 0.0008 0.0010 zero not foundto desired tolerance p.2.5 [1 2] step a b m ym bound 1.0000 1.0000 2.0000 1.5000 -0.6250 0.5000 2.0000 1.5000 2.0000 1.7500 1.3594 0.2500 3.0000 1.5000 1.7500 1.6250 0.2910 0.1250 4.0000 1.5000 1.6250 1.5625 -0.1853 0.0625 5.0000 1.5625 1.6250 1.5938 0.0482 0.0313 6.0000 1.5625 1.5938 1.5781 -0.0697 0.0156 7.0000 1.5781 1.5938 1.5859 -0.0111 0.0078 zero not foundto desiredtolerance p.2.6 [1 2] step a b m ym bound 1.0000 1.0000 2.0000 1.5000 -2.6250 0.5000 2.0000 1.5000 2.0000 1.7500 -0.6406 0.2500 3.0000 1.7500 2.0000 1.8750 0.5918 0.1250 4.0000 1.7500 1.8750 1.8125 -0.0457 0.0625 5.0000 1.8125 1.8750 1.8438 0.2677 0.0313 6.0000 1.8125 1.8438 1.8281 0.1097 0.0156 7.0000 1.8125 1.8281 1.8203 0.0317 0.0078 zero not foundto desiredtolerance
  • 3. p.2.7 [ 0 1] step a b m ym bound 1.0000 0 1.0000 0.5000 -0.3875 0.5000 2.0000 0.5000 1.0000 0.7500 -0.1336 0.2500 3.0000 0.7500 1.0000 0.8750 0.1362 0.1250 4.0000 0.7500 0.8750 0.8125 -0.0142 0.0625 5.0000 0.8125 0.8750 0.8438 0.0568 0.0313 6.0000 0.8125 0.8438 0.8281 0.0203 0.0156 7.0000 0.8125 0.8281 0.8203 0.0028 0.0078 zero not foundto desiredtolerance p.2.8 [ 0 1] step a b m ym bound 1.0000 0 1.0000 0.5000 -0.5875 0.5000 2.0000 0.5000 1.0000 0.7500 -0.3336 0.2500 3.0000 0.7500 1.0000 0.8750 -0.0638 0.1250 4.0000 0.8750 1.0000 0.9375 0.1225 0.0625 5.0000 0.8750 0.9375 0.9063 0.0245 0.0313 6.0000 0.8750 0.9063 0.8906 -0.0208 0.0156 7.0000 0.8906 0.9063 0.8984 0.0016 0.0078 zero not foundto desired tolerance p.2.9 [ 0 1] step a b m ym bound 1.0000 0 1.0000 0.5000 0.0025 0.5000 2.0000 0 0.5000 0.2500 -0.0561 0.2500 3.0000 0.2500 0.5000 0.3750 -0.0402 0.1250 4.0000 0.3750 0.5000 0.4375 -0.0234 0.0625 5.0000 0.4375 0.5000 0.4688 -0.0117 0.0313 6.0000 0.4688 0.5000 0.4844 -0.0050 0.0156 7.0000 0.4844 0.5000 0.4922 -0.0013 0.0078 zero not foundto desiredtolerence p.2.10
  • 4. [ 0 1] step a b m ym bound 1.0000 0 1.0000 0.5000 -0.1875 0.5000 2.0000 0.5000 1.0000 0.7500 0.0664 0.2500 3.0000 0.5000 0.7500 0.6250 -0.0974 0.1250 4.0000 0.6250 0.7500 0.6875 -0.0266 0.0625 5.0000 0.6875 0.7500 0.7188 0.0169 0.0313 6.0000 0.6875 0.7188 0.7031 -0.0056 0.0156 7.0000 0.7031 0.7188 0.7109 0.0055 0.0078 zero not foundto desired tolerance p.2.11 (a) [0 1] step a b m ym bound 1.0000 0 1.0000 0.5000 -2.3750 0.5000 2.0000 0 0.5000 0.2500 -0.2344 0.2500 3.0000 0 0.2500 0.1250 0.8770 0.1250 4.0000 0.1250 0.2500 0.1875 0.3191 0.0625 5.0000 0.1875 0.2500 0.2188 0.0417 0.0313 6.0000 0.2188 0.2500 0.2344 -0.0965 0.0156 7.0000 0.2188 0.2344 0.2266 -0.0274 0.0078 8.0000 0.2188 0.2266 0.2227 0.0071 0.0039 9.0000 0.2227 0.2266 0.2246 -0.0102 0.0020 10.0000 0.2227 0.2246 0.2236 -0.0015 0.0010 zero not foundto desired tolerance (b) [2 3] step a b m ym bound 1.0000 2.0000 3.0000 2.5000 -4.8750 0.5000 2.0000 2.5000 3.0000 2.7500 -1.9531 0.2500 3.0000 2.7500 3.0000 2.8750 -0.1113 0.1250 4.0000 2.8750 3.0000 2.9375 0.9099 0.0625 5.0000 2.8750 2.9375 2.9063 0.3908 0.0313 6.0000 2.8750 2.9063 2.8906 0.1376 0.0156 7.0000 2.8750 2.8906 2.8828 0.0126 0.0078 8.0000 2.8750 2.8828 2.8789 -0.0495 0.0039 9.0000 2.8789 2.8828 2.8809 -0.0185 0.0020 10.0000 2.8809 2.8828 2.8818 -0.0029 0.0010 zero not foundto desired tolerance (c) [-3 -4] step a b m ym bound 1.0000 -3.0000 -4.0000 -3.5000 -9.3750 -0.5000 2.0000 -3.0000 -3.5000 -3.2500 -3.0781 -0.2500 3.0000 -3.0000 -3.2500 -3.1250 -0.3926 -0.1250
  • 5. 4.0000 -3.0000 -3.1250 -3.0625 0.8396 -0.0625 5.0000 -3.0625 -3.1250 -3.0938 0.2326 -0.0313 6.0000 -3.0938 -3.1250 -3.1094 -0.0777 -0.0156 7.0000 -3.0938 -3.1094 -3.1016 0.0780 -0.0078 8.0000 -3.1016 -3.1094 -3.1055 0.0003 -0.0039 zero not foundto desired tolerance p.2.12 one real and 2 imaginary roots step a b m ym bound 1.0000 2.0000 3.0000 2.5000 -1.8750 0.5000 2.0000 2.5000 3.0000 2.7500 0.6719 0.2500 3.0000 2.5000 2.7500 2.6250 -0.6934 0.1250 4.0000 2.6250 2.7500 2.6875 -0.0344 0.0625 5.0000 2.6875 2.7500 2.7188 0.3127 0.0313 6.0000 2.6875 2.7188 2.7031 0.1377 0.0156 7.0000 2.6875 2.7031 2.6953 0.0512 0.0078 8.0000 2.6875 2.6953 2.6914 0.0083 0.0039 9.0000 2.6875 2.6914 2.6895 -0.0131 0.0020 10.0000 2.6895 2.6914 2.6904 -0.0024 0.0010 zero not foundto desiredtolerence p.2.13 (a) [0 1] step a b m ym bound 1.0000 0 1.0000 0.5000 -0.1250 0.5000 2.0000 0.5000 1.0000 0.7500 1.1094 0.2500 3.0000 0.5000 0.7500 0.6250 0.4160 0.1250 4.0000 0.5000 0.6250 0.5625 0.1272 0.0625 5.0000 0.5000 0.5625 0.5313 -0.0034 0.0313 6.0000 0.5313 0.5625 0.5469 0.0608 0.0156 7.0000 0.5313 0.5469 0.5391 0.0284 0.0078 8.0000 0.5313 0.5391 0.5352 0.0124 0.0039 9.0000 0.5313 0.5352 0.5332 0.0045 0.0020 10.0000 0.5313 0.5332 0.5322 0.0006 0.0010 zero not foundto desiredtolerence (b) [0 -1] step a b m ym bound 1.0000 0 -1.0000 -0.5000 -0.3750 -0.5000 2.0000 -0.5000 -1.0000 -0.7500 0.2656 -0.2500 3.0000 -0.5000 -0.7500 -0.6250 -0.0723 -0.1250 4.0000 -0.6250 -0.7500 -0.6875 0.0930 -0.0625
  • 6. 5.0000 -0.6250 -0.6875 -0.6563 0.0094 -0.0313 6.0000 -0.6250 -0.6563 -0.6406 -0.0317 -0.0156 7.0000 -0.6406 -0.6563 -0.6484 -0.0112 -0.0078 8.0000 -0.6484 -0.6563 -0.6523 -0.0009 -0.0039 9.0000 -0.6523 -0.6563 -0.6543 0.0042 -0.0020 10.0000 -0.6523 -0.6543 -0.6533 0.0016 -0.0010 (c) [-2 -3] step a b m ym bound 1.0000 -2.0000 -3.0000 -2.5000 2.1250 -0.5000 2.0000 -2.5000 -3.0000 -2.7500 0.8906 -0.2500 3.0000 -2.7500 -3.0000 -2.8750 0.0332 -0.1250 4.0000 -2.8750 -3.0000 -2.9375 -0.4607 -0.0625 5.0000 -2.8750 -2.9375 -2.9063 -0.2082 -0.0313 6.0000 -2.8750 -2.9063 -2.8906 -0.0861 -0.0156 7.0000 -2.8750 -2.8906 -2.8828 -0.0261 -0.0078 8.0000 -2.8750 -2.8828 -2.8789 0.0036 -0.0039 9.0000 -2.8789 -2.8828 -2.8809 -0.0112 -0.0020 10.0000 -2.8789 -2.8809 -2.8799 -0.0038 -0.0010 zero not foundto desired tolerance p.2.14 (a) [0 1] step a b m ym bound 1.0000 0 1.0000 0.5000 -0.8750 0.5000 2.0000 0 0.5000 0.2500 0.0156 0.2500 3.0000 0.2500 0.5000 0.3750 -0.4473 0.1250 4.0000 0.2500 0.3750 0.3125 -0.2195 0.0625 5.0000 0.2500 0.3125 0.2813 -0.1028 0.0313 6.0000 0.2500 0.2813 0.2656 -0.0438 0.0156 7.0000 0.2500 0.2656 0.2578 -0.0141 0.0078 8.0000 0.2500 0.2578 0.2539 0.0007 0.0039 9.0000 0.2539 0.2578 0.2559 -0.0067 0.0020 10.0000 0.2539 0.2559 0.2549 -0.0030 0.0010 zero not foundto desired tolerance (b) [1 2] step a b m ym bound 1.0000 1.0000 2.0000 1.5000 -1.6250 0.5000 2.0000 1.5000 2.0000 1.7500 -0.6406 0.2500 3.0000 1.7500 2.0000 1.8750 0.0918 0.1250 4.0000 1.7500 1.8750 1.8125 -0.2957 0.0625 5.0000 1.8125 1.8750 1.8438 -0.1073 0.0313 6.0000 1.8438 1.8750 1.8594 -0.0091 0.0156
  • 7. 7.0000 1.8594 1.8750 1.8672 0.0410 0.0078 8.0000 1.8594 1.8672 1.8633 0.0158 0.0039 9.0000 1.8594 1.8633 1.8613 0.0033 0.0020 10.0000 1.8594 1.8613 1.8604 -0.0029 0.0010 zero not foundto desired tolerance (c) [-2 -3] step a b m ym bound 1.0000 -2.0000 -3.0000 -2.5000 -4.6250 -0.5000 2.0000 -2.0000 -2.5000 -2.2500 -1.3906 -0.2500 3.0000 -2.0000 -2.2500 -2.1250 -0.0957 -0.1250 4.0000 -2.0000 -2.1250 -2.0625 0.4763 -0.0625 5.0000 -2.0625 -2.1250 -2.0938 0.1964 -0.0313 6.0000 -2.0938 -2.1250 -2.1094 0.0519 -0.0156 7.0000 -2.1094 -2.1250 -2.1172 -0.0215 -0.0078 8.0000 -2.1094 -2.1172 -2.1133 0.0153 -0.0039 9.0000 -2.1133 -2.1172 -2.1152 -0.0031 -0.0020 10.0000 -2.1133 -2.1152 -2.1143 0.0061 -0.0010 zero not foundto desiredtolerence >> p.2.15 [2 3] step a b m ym bound 1.0000 2.0000 3.0000 2.5000 -3.6250 0.5000 2.0000 2.5000 3.0000 2.7500 -0.7656 0.2500 3.0000 2.7500 3.0000 2.8750 0.9980 0.1250 4.0000 2.7500 2.8750 2.8125 0.0872 0.0625 5.0000 2.7500 2.8125 2.7813 -0.3464 0.0313 6.0000 2.7813 2.8125 2.7969 -0.1314 0.0156 7.0000 2.7969 2.8125 2.8047 -0.0226 0.0078 8.0000 2.8047 2.8125 2.8086 0.0322 0.0039 9.0000 2.8047 2.8086 2.8066 0.0048 0.0020 10.0000 2.8047 2.8066 2.8057 -0.0089 0.0010 zero not foundto desired tolerance p.2.16 [0 1] step a b m ym bound 1.0000 0 1.0000 0.5000 -0.8750 0.5000 2.0000 0.5000 1.0000 0.7500 0.2969 0.2500 3.0000 0.5000 0.7500 0.6250 -0.2246 0.1250 4.0000 0.6250 0.7500 0.6875 0.0515 0.0625
  • 8. 5.0000 0.6250 0.6875 0.6563 -0.0826 0.0313 6.0000 0.6563 0.6875 0.6719 -0.0146 0.0156 7.0000 0.6719 0.6875 0.6797 0.0187 0.0078 8.0000 0.6719 0.6797 0.6758 0.0021 0.0039 9.0000 0.6719 0.6758 0.6738 -0.0062 0.0020 10.0000 0.6738 0.6758 0.6748 -0.0020 0.0010 zero not foundto desiredtolerence p.2.17 (a) [ 1 2] step a b m ym bound 1.0000 1.0000 2.0000 1.5000 -1.5000 0.5000 2.0000 1.0000 1.5000 1.2500 0.7813 0.2500 3.0000 1.2500 1.5000 1.3750 -0.3867 0.1250 4.0000 1.2500 1.3750 1.3125 0.1948 0.0625 5.0000 1.3125 1.3750 1.3438 -0.0971 0.0313 6.0000 1.3125 1.3438 1.3281 0.0486 0.0156 7.0000 1.3281 1.3438 1.3359 -0.0243 0.0078 8.0000 1.3281 1.3359 1.3320 0.0122 0.0039 9.0000 1.3320 1.3359 1.3340 -0.0061 0.0020 10.0000 1.3320 1.3340 1.3330 0.0030 0.0010 zero not foundto desiredtolerence (b) [2 3] step a b m ym bound 1.0000 2.0000 3.0000 2.5000 0 0.5000 bisectionhas converged (c) 0 p.2.18 (a) [0 1] step a b m ym bound 1.0000 0 1.0000 0.5000 -2.8750 0.5000 2.0000 0 0.5000 0.2500 1.4844 0.2500 3.0000 0.2500 0.5000 0.3750 -0.7324 0.1250 4.0000 0.2500 0.3750 0.3125 0.3689 0.0625 5.0000 0.3125 0.3750 0.3438 -0.1838 0.0313 6.0000 0.3125 0.3438 0.3281 0.0921 0.0156 7.0000 0.3281 0.3438 0.3359 -0.0460 0.0078 8.0000 0.3281 0.3359 0.3320 0.0230 0.0039 9.0000 0.3320 0.3359 0.3340 -0.0115 0.0020
  • 9. 10.0000 0.3320 0.3340 0.3330 0.0058 0.0010 zero not foundto desiredtolerence (b) [-2 -3] step a b m ym bound 1.0000 -2.0000 -3.0000 -2.5000 -2.1250 -0.5000 2.0000 -2.0000 -2.5000 -2.2500 7.2656 -0.2500 3.0000 -2.2500 -2.5000 -2.3750 2.9199 -0.1250 4.0000 -2.3750 -2.5000 -2.4375 0.4871 -0.0625 5.0000 -2.4375 -2.5000 -2.4688 -0.7963 -0.0313 6.0000 -2.4375 -2.4688 -2.4531 -0.1490 -0.0156 7.0000 -2.4375 -2.4531 -2.4453 0.1704 -0.0078 8.0000 -2.4453 -2.4531 -2.4492 0.0111 -0.0039 9.0000 -2.4492 -2.4531 -2.4512 -0.0689 -0.0020 10.0000 -2.4492 -2.4512 -2.4502 -0.0289 -0.0010 zero not foundto desired tolerance (c) [2 3] step a b m ym bound 1.0000 2.0000 3.0000 2.5000 1.6250 0.5000 2.0000 2.0000 2.5000 2.2500 -5.3906 0.2500 3.0000 2.2500 2.5000 2.3750 -2.2012 0.1250 4.0000 2.3750 2.5000 2.4375 -0.3699 0.0625 5.0000 2.4375 2.5000 2.4688 0.6068 0.0313 6.0000 2.4375 2.4688 2.4531 0.1133 0.0156 7.0000 2.4375 2.4531 2.4453 -0.1295 0.0078 8.0000 2.4453 2.4531 2.4492 -0.0084 0.0039 9.0000 2.4492 2.4531 2.4512 0.0524 0.0020 10.0000 2.4492 2.4512 2.4502 0.0220 0.0010 zero not foundto desired tolerance p.2.19 (a) [-1 -2] step a b m ym bound 1.0000 -1.0000 -2.0000 -1.5000 -1.6250 -0.5000 2.0000 -1.5000 -2.0000 -1.7500 1.5781 -0.2500 3.0000 -1.5000 -1.7500 -1.6250 0.0684 -0.1250 4.0000 -1.5000 -1.6250 -1.5625 -0.7561 -0.0625 5.0000 -1.5625 -1.6250 -1.5938 -0.3382 -0.0313 6.0000 -1.5938 -1.6250 -1.6094 -0.1335 -0.0156 7.0000 -1.6094 -1.6250 -1.6172 -0.0322 -0.0078 8.0000 -1.6172 -1.6250 -1.6211 0.0182 -0.0039 9.0000 -1.6172 -1.6211 -1.6191 -0.0070 -0.0020 10.0000 -1.6191 -1.6211 -1.6201 0.0056 -0.0010 zero not foundto desiredtolerence
  • 10. (b) [5 6] step a b m ym bound 1.0000 5.0000 6.0000 5.5000 -27.8750 0.5000 2.0000 5.5000 6.0000 5.7500 -12.9531 0.2500 3.0000 5.7500 6.0000 5.8750 -4.7363 0.1250 4.0000 5.8750 6.0000 5.9375 -0.4338 0.0625 5.0000 5.9375 6.0000 5.9688 1.7666 0.0313 6.0000 5.9375 5.9688 5.9531 0.6623 0.0156 7.0000 5.9375 5.9531 5.9453 0.1132 0.0078 8.0000 5.9375 5.9453 5.9414 -0.1606 0.0039 9.0000 5.9414 5.9453 5.9434 -0.0238 0.0020 10.0000 5.9434 5.9453 5.9443 0.0447 0.0010 zero not foundto desiredtolerence (c) [-3 -4] step a b m ym bound 1.0000 -3.0000 -4.0000 -3.5000 -3.1250 -0.5000 2.0000 -3.0000 -3.5000 -3.2500 1.1094 -0.2500 3.0000 -3.2500 -3.5000 -3.3750 -0.8340 -0.1250 4.0000 -3.2500 -3.3750 -3.3125 0.1804 -0.0625 5.0000 -3.3125 -3.3750 -3.3438 -0.3160 -0.0313 6.0000 -3.3125 -3.3438 -3.3281 -0.0651 -0.0156 7.0000 -3.3125 -3.3281 -3.3203 0.0583 -0.0078 8.0000 -3.3203 -3.3281 -3.3242 -0.0032 -0.0039 9.0000 -3.3203 -3.3242 -3.3223 0.0276 -0.0020 10.0000 -3.3223 -3.3242 -3.3232 0.0122 -0.0010 zero not foundto desiredtolerence p.2.20 (a) [3 4] step a b m ym bound 1.0000 3.0000 4.0000 3.5000 -0.8750 0.5000 2.0000 3.5000 4.0000 3.7500 -0.2031 0.2500 3.0000 3.7500 4.0000 3.8750 0.3262 0.1250 4.0000 3.7500 3.8750 3.8125 0.0442 0.0625 5.0000 3.7500 3.8125 3.7813 -0.0837 0.0313 6.0000 3.7813 3.8125 3.7969 -0.0208 0.0156 7.0000 3.7969 3.8125 3.8047 0.0114 0.0078 8.0000 3.7969 3.8047 3.8008 -0.0048 0.0039 9.0000 3.8008 3.8047 3.8027 0.0033 0.0020 10.0000 3.8008 3.8027 3.8018 -0.0007 0.0010 zero not foundto desiredtolerence (b) [0 1]
  • 11. step a b m ym bound 1.0000 0 1.0000 0.5000 -1.6250 0.5000 2.0000 0.5000 1.0000 0.7500 -0.0156 0.2500 3.0000 0.7500 1.0000 0.8750 0.5605 0.1250 4.0000 0.7500 0.8750 0.8125 0.2903 0.0625 5.0000 0.7500 0.8125 0.7813 0.1419 0.0313 6.0000 0.7500 0.7813 0.7656 0.0643 0.0156 7.0000 0.7500 0.7656 0.7578 0.0246 0.0078 8.0000 0.7500 0.7578 0.7539 0.0046 0.0039 9.0000 0.7500 0.7539 0.7520 -0.0055 0.0020 10.0000 0.7520 0.7539 0.7529 -0.0005 0.0010 zero not foundto desiredtolerence >> SECANT METHOD p.2.1 [-1 2] secant(inline('x^2-2'),-1,2,0.005,7) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1 -1 2 0 -2 -2 2 2 0 1 -1 1 3 0 1 2 2 1 4 1.0000 2.0000 1.3333 -0.2222 -0.6667 5 2.0000 1.3333 1.4000 -0.0400 0.0667 6 1.3333 1.4000 1.4146 0.0012 0.0146 secantmethod has converged ans = 1.4146 p.2.2 [ 2 3] secant(inline('x^2-5'),2,3,0.005,7) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1 2.0000 3.0000 2.2000 -0.1600 -0.8000 2 3.0000 2.2000 2.2308 -0.0237 0.0308 3 2.2000 2.2308 2.2361 0.0002 0.0053 secantmethod has converged ans = 2.2361
  • 12. p.2.3 [ 2 3] >> secant(inline('x^2-7'),2,3,0.005,7) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1 2.0000 3.0000 2.6000 -0.2400 -0.4000 2 3.0000 2.6000 2.6429 -0.0153 0.0429 3 2.6000 2.6429 2.6458 0.0001 0.0029 secantmethod has converged ans = 2.6458 p.2.4 [1 2] secant(inline('x^3-6'),1,2,0.005,7) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1 1.0000 2.0000 1.7143 -0.9621 -0.2857 2 2.0000 1.7143 1.8071 -0.0988 0.0928 3 1.7143 1.8071 1.8177 0.0059 0.0106 4. 1.8071 1.8177 1.8171 -0.0000 -0.0006 secantmethod has converged ans = 1.8171 p.2.5 [1 2] secant(inline('x^3-4'),1,2,0.005,7) step x(k-1) x (k) x(k+1) y(k+1) dx(k+1) 1 1.0000 2.0000 1.4286 -1.0845 -0.5714 2 2.0000 1.4286 1.5505 -0.2728 0.1219 3 1.4286 1.5505 1.5914 0.0305 0.0410 4 1.5505 1.5914 1.5873 -0.0007 -0.0041 secantmethod has converged ans = 1.5873 p.2.6
  • 13. [1 2] secant(inline('x^3-6'),1,2,0.005,7) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 1.0000 2.0000 1.7143 -0.9621 -0.2857 2.0000 2.0000 1.7143 1.8071 -0.0988 0.0928 3.0000 1.7143 1.8071 1.8177 0.0059 0.0106 4.0000 1.8071 1.8177 1.8171 -0.0000 -0.0006 secantmethod has converged ans = 1.8171 p.2.7 [ 0 1] secant(inline('x^4-0.45'),0,1,0.005,7) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 0 1.0000 0.4500 -0.4090 -0.5500 2.0000 1.0000 0.4500 0.6846 -0.2304 0.2346 3.0000 0.4500 0.6846 0.9871 0.4995 0.3026 4.0000 0.6846 0.9871 0.7801 -0.0797 -0.2071 5.0000 0.9871 0.7801 0.8086 -0.0226 0.0285 6.0000 0.7801 0.8086 0.8198 0.0017 0.0113 secantmethod has converged ans = 0.8198 p.2.8 [ 0 1] secant(inline('x^4-0.65'),0,1,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 0 1.0000 0.6500 -0.4715 -0.3500 2.0000 1.0000 0.6500 0.8509 -0.1258 0.2009 3.0000 0.6500 0.8509 0.9240 0.0789 0.0731 4.0000 0.8509 0.9240 0.8958 -0.0060 -0.0282 5.0000 0.9240 0.8958 0.8978 -0.0003 0.0020 secantmethod has converged ans = 0.8978
  • 14. >> p.2.9 sm prob of e p.2.10 [ 0 1] secant(inline('x^4-0.25'),0,1,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 0 1.0000 0.2500 -0.2461 -0.7500 2.0000 1.0000 0.2500 0.4353 -0.2141 0.1853 3.0000 0.2500 0.4353 1.6751 7.6241 1.2398 4.0000 0.4353 1.6751 0.4692 -0.2016 -1.2060 5.0000 1.6751 0.4692 0.5002 -0.1874 0.0311 6.0000 0.4692 0.5002 0.9112 0.4395 0.4110 7.0000 0.5002 0.9112 0.6231 -0.0993 -0.2881 ans = 0.6231 >> p.2.11 (a) [0 1] secant(inline('x^3-9*x+2'),0,1,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 0 1.0000 0.2500 -0.2344 -0.7500 2.0000 1.0000 0.2500 0.2195 0.0350 -0.0305 3.0000 0.2500 0.2195 0.2235 -0.0001 0.0040 secantmethod has converged ans = 0.2235 (b) [-3 -4] secant(inline('x^3-9*x+2'),-3,-4,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 -3.0000 -4.0000 -3.0714 0.6680 0.9286 2.0000 -4.0000 -3.0714 -3.0947 0.2141 -0.0233 3.0000 -3.0714 -3.0947 -3.1057 -0.0035 -0.0110 secantmethod has converged ans =
  • 15. -3.1057 (c) [2 3] secant(inline('x^3-9*x+2'),2,3,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 2.0000 3.0000 2.8000 -1.2480 -0.2000 2.0000 3.0000 2.8000 2.8768 -0.0821 0.0768 3.0000 2.8000 2.8768 2.8823 0.0038 0.0054 secantmethod has converged ans = 2.8823 >> p.2.12 secant(inline('x^3-2*x^2-5'),2,3,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 2.0000 3.0000 2.5556 -1.3717 -0.4444 2.0000 3.0000 2.5556 2.6691 -0.2338 0.1135 3.0000 2.5556 2.6691 2.6924 0.0189 0.0233 4.0000 2.6691 2.6924 2.6906 -0.0002 -0.0017 secantmethod has converged ans = 2.6906 p.2.13 (a) [-2 -3] secant(inline('x^3+3*x^2-1'),-2,-3,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 -2.0000 -3.0000 -2.7500 0.8906 0.2500 2.0000 -3.0000 -2.7500 -2.8678 0.0875 -0.1178 3.0000 -2.7500 -2.8678 -2.8806 -0.0092 -0.0128 4.0000 -2.8678 -2.8806 -2.8794 0.0001 0.0012 secantmethod has converged ans = -2.8794 (b) [0 -1] secant(inline('x^3+3*x^2-1'),0,-1,0.005,8)
  • 16. step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 0 -1.0000 -0.5000 -0.3750 0.5000 2.0000 -1.0000 -0.5000 -0.6364 -0.0428 -0.1364 3.0000 -0.5000 -0.6364 -0.6539 0.0033 -0.0176 secantmethod has converged ans = -0.6539 (c) [0 1] secant(inline('x^3+3*x^2-1'),0,1,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 0 1.0000 0.2500 -0.7969 -0.7500 2.0000 1.0000 0.2500 0.4074 -0.4344 0.1574 3.0000 0.2500 0.4074 0.5961 0.2777 0.1887 4.0000 0.4074 0.5961 0.5225 -0.0383 -0.0736 5.0000 0.5961 0.5225 0.5314 -0.0027 0.0089 secantmethod has converged ans = 0.5314 p.2.14 (a) [0 1] secant(inline('x^3-4*x+1'),0,1,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 0 1.0000 0.3333 -0.2963 -0.6667 2.0000 1.0000 0.3333 0.2174 0.1407 -0.1159 3.0000 0.3333 0.2174 0.2547 -0.0024 0.0373 secantmethod has converged ans = 0.2547 (b) [1 2] secant(inline('x^3-4*x+1'),1,2,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 1.0000 2.0000 1.6667 -1.0370 -0.3333 2.0000 2.0000 1.6667 1.8364 -0.1528 0.1697 3.0000 1.6667 1.8364 1.8657 0.0313 0.0293 4.0000 1.8364 1.8657 1.8607 -0.0007 -0.0050 secantmethod has converged ans = 1.8607
  • 17. (c) [-2 -3] secant(inline('x^3-4*x+1'),-2,-3,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 -2.0000 -3.0000 -2.0667 0.4397 0.9333 2.0000 -3.0000 -2.0667 -2.0951 0.1842 -0.0284 3.0000 -2.0667 -2.0951 -2.1156 -0.0063 -0.0205 4.0000 -2.0951 -2.1156 -2.1149 0.0001 0.0007 secantmethod has converged ans = -2.1149 p.2.15 [2 3] secant(inline('x^3-x^2-4*x-3'),2,3,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 2.0000 3.0000 2.7000 -1.4070 -0.3000 2.0000 3.0000 2.7000 2.7958 -0.1466 0.0958 3.0000 2.7000 2.7958 2.8069 0.0087 0.0111 4.0000 2.7958 2.8069 2.8063 -0.0000 -0.0006 secantmethod has converged ans = 2.8063 p.2.16 [0 1] secant(inline('x^3-6*x^2+11*x-5'),0,1,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 0 1.0000 0.8333 0.5787 -0.1667 2.0000 1.0000 0.8333 0.6044 -0.3226 -0.2289 3.0000 0.8333 0.6044 0.6863 0.0467 0.0819 4.0000 0.6044 0.6863 0.6760 0.0030 -0.0104 secantmethod has converged ans = 0.6760
  • 18. p.2.17 (a) [ 1 2] secant(inline('6*x^3-23*x^2+20*x'),1,2,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 1.0000 2.0000 1.4286 -0.8746 -0.5714 2.0000 2.0000 1.4286 1.2687 0.6062 -0.1599 3.0000 1.4286 1.2687 1.3341 -0.0073 0.0655 4.0000 1.2687 1.3341 1.3333 -0.0000 -0.0008 secantmethod has converged ans = 1.3333 (b) [2 3] Secant(inline('6*x^3-23*x^2+20*x'),2,3,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 2.0000 3.0000 2.2105 -3.3678 -0.7895 2.0000 3.0000 2.2105 2.3553 -2.0900 0.1448 3.0000 2.2105 2.3553 2.5920 1.8018 0.2368 4.0000 2.3553 2.5920 2.4824 -0.3007 -0.1096 5.0000 2.5920 2.4824 2.4981 -0.0330 0.0157 6.0000 2.4824 2.4981 2.5000 0.0007 0.0019 secantmethod has converged ans = 2.5000 p.2.18 (a) [2 3] secant(inline('3*x^3-x^2-18*x+6'),2,3,0.005,8) step x(k-1) x(k) x (k+1) y(k+1) dx(k+1) 1.0000 2.0000 3.0000 2.2941 -4.3354 -0.7059 2.0000 3.0000 2.2941 2.4021 -1.4263 0.1080 3.0000 2.2941 2.4021 2.4551 0.1743 0.0530 4.0000 2.4021 2.4551 2.4493 -0.0057 -0.0058 5.0000 2.4551 2.4493 2.4495 -0.0000 0.0002 secantmethod has converged ans = 2.4495
  • 19. (b) [-2 -3] secant(inline('3*x^3-x^2-18*x+6'),-2,-3,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 -2.0000 -3.0000 -2.3182 4.9798 0.6818 2.0000 -3.0000 -2.3182 -2.4152 1.3736 -0.0971 3.0000 -2.3182 -2.4152 -2.4522 -0.1118 -0.0370 4.0000 -2.4152 -2.4522 -2.4494 0.0022 0.0028 secantmethod has converged ans = -2.4494 (c) [0 1] secant(inline('3*x^3-x^2-18*x+6'),0,1,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 0 1.0000 0.3750 -0.7324 -0.6250 2.0000 1.0000 0.3750 0.3256 0.1366 -0.0494 3.0000 0.3750 0.3256 0.3334 -0.0007 0.0078 secantmethod has converged ans = 0.3334 p.2.19 (a) [-1 -2] secant(inline('x^3-x^2-24*x-32'),-1,-2,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 -1.0000 -2.0000 -1.7143 1.1662 0.2857 2.0000 -2.0000 -1.7143 -1.5967 -0.2993 0.1176 3.0000 -1.7143 -1.5967 -1.6207 0.0133 -0.0240 4.0000 -1.5967 -1.6207 -1.6197 0.0001 0.0010 secantmethod has converged ans = -1.6197 (b) [5 6] secant(inline('x^3-x^2-24*x-32'),5,6,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 5.0000 6.0000 5.9286 -1.0565 -0.0714 2.0000 6.0000 5.9286 5.9435 -0.0142 0.0149 3.0000 5.9286 5.9435 5.9437 0.0001 0.0002 secantmethod has converged ans =
  • 20. 5.9437 (c) [-3 -4] secant(inline('x^3-x^2-24*x-32'),-3,-4,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 -3.0000 -4.0000 -3.2000 1.7920 0.8000 2.0000 -4.0000 -3.2000 -3.2806 0.6655 -0.0806 3.0000 -3.2000 -3.2806 -3.3282 -0.0659 -0.0476 4.0000 -3.2806 -3.3282 -3.3239 0.0020 0.0043 secantmethod has converged ans = -3.3239 p.2.20 (a) [-3 -4] secant(inline('x^3-7*x^2+14*x-7'),-3,-4,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 -3.0000 -4.0000 -1.6100 -51.8580 2.3900 2.0000 -4.0000 -1.6100 -0.9477 -27.4065 0.6623 3.0000 -1.6100 -0.9477 -0.2054 -10.1796 0.7423 4.0000 -0.9477 -0.2054 0.2332 -4.1027 0.4386 5.0000 -0.2054 0.2332 0.5294 -1.4020 0.2961 6.0000 0.2332 0.5294 0.6831 -0.3841 0.1537 7.0000 0.5294 0.6831 0.7411 -0.0620 0.0580 ans = 0.7411 (b) [3 4] secant(inline('x^3-7*x^2+14*x-7'),3,4,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 3.0000 4.0000 3.5000 -0.8750 -0.5000 2.0000 4.0000 3.5000 3.7333 -0.2634 0.2333 3.0000 3.5000 3.7333 3.8338 0.1364 0.1005 4.0000 3.7333 3.8338 3.7995 -0.0099 -0.0343 5.0000 3.8338 3.7995 3.8019 -0.0003 0.0023 secantmethod has converged ans = 3.8019 (c) [0 1]
  • 21. >> secant(inline('x^3-7*x^2+14*x-7'),0,1,0.005,8) step x(k-1) x(k) x(k+1) y(k+1) dx(k+1) 1.0000 0 1.0000 0.8750 0.5605 -0.1250 2.0000 1.0000 0.8750 0.7156 -0.2000 -0.1594 3.0000 0.8750 0.7156 0.7575 0.0229 0.0419 4.0000 0.7156 0.7575 0.7532 0.0008 -0.0043 secantmethod has converged ans = 0.7532 REGULA FALSI METHOD Falsi method Q1 [s,y]=falsi(inline('x^2-2'),1,2,0.005,5) step a b s y 1.0000 1.0000 2.0000 1.3333 -0.2222 2.0000 1.3333 2.0000 1.4000 -0.0400 3.0000 1.4000 2.0000 1.4118 -0.0069 4.0000 1.4118 2.0000 1.4138 -0.0012 regulafalsi methodhasconverged s = 1.4138 y = -0.0012 Q2. [s,y]=falsi(inline('x^2-5'),2,3,0.005,5) step a b s y 1.0000 2.0000 3.0000 2.2000 -0.1600 2.0000 2.2000 3.0000 2.2308 -0.0237 3.0000 2.2308 3.0000 2.2353 -0.0035 regulafalsi methodhasconverged s = 2.2353 y = -0.0035 Q3
  • 22. >> [s,y]=falsi(inline('x^2-7'),2,3,0.005,5) step a b s y 1.0000 2.0000 3.0000 2.6000 -0.2400 2.0000 2.6000 3.0000 2.6429 -0.0153 3.0000 2.6429 3.0000 2.6456 -0.0010 regulafalsi methodhasconverged s = 2.6456 y = -9.6138e-004 Q4 >> [s,y]=falsi(inline('x^3-3'),1,2,0.005,5) step a b s y 1.0000 1.0000 2.0000 1.2857 -0.8746 2.0000 1.2857 2.0000 1.3921 -0.3024 3.0000 1.3921 2.0000 1.4267 -0.0958 4.0000 1.4267 2.0000 1.4375 -0.0295 5.0000 1.4375 2.0000 1.4408 -0.0090 ZERO NOT FOUND TO DESIRED TOLERANCE s = 1.4408 y = -0.0090 Q5 >> [s,y]=falsi(inline('x^3-4'),1,2,0.005,5) step a b s y 1.0000 1.0000 2.0000 1.4286 -1.0845 2.0000 1.4286 2.0000 1.5505 -0.2728 3.0000 1.5505 2.0000 1.5792 -0.0620 4.0000 1.5792 2.0000 1.5856 -0.0137 5.0000 1.5856 2.0000 1.5870 -0.0030 regulafalsi methodhasconverged s = 1.5870 y = -0.0030 Q6 >> [s,y]=falsi(inline('x^3-6'),1,2,0.005,5) step a b s y 1.0000 1.0000 2.0000 1.7143 -0.9621 2.0000 1.7143 2.0000 1.8071 -0.0988
  • 23. 3.0000 1.8071 2.0000 1.8162 -0.0094 4.0000 1.8162 2.0000 1.8170 -0.0009 regulafalsi methodhasconverged s = 1.8170 y = -8.8557e-004 Q7 >> [s,y]=falsi(inline('x^4-0.45'),0,1,0.005,5) step a b s y 1.0000 0 1.0000 0.4500 -0.4090 2.0000 0.4500 1.0000 0.6846 -0.2304 3.0000 0.6846 1.0000 0.7777 -0.0842 4.0000 0.7777 1.0000 0.8072 -0.0254 5.0000 0.8072 1.0000 0.8157 -0.0072 ZERO NOT FOUND TO DESIRED TOLERANCE s = 0.8157 y = -0.0072 Q8 >> [s,y]=falsi(inline('x^4-0.65'),0,1,0.005,5) step a b s y 1.0000 0 1.0000 0.6500 -0.4715 2.0000 0.6500 1.0000 0.8509 -0.1258 3.0000 0.8509 1.0000 0.8903 -0.0217 4.0000 0.8903 1.0000 0.8967 -0.0034 regulafalsi methodhasconverged s = 0.8967 y = -0.0034 Q9 >> [s,y]=falsi(inline('x^4-0.06'),0,1,0.005,5) step a b s y 1.0000 0 1.0000 0.0600 -0.0600 2.0000 0.0600 1.0000 0.1164 -0.0598 3.0000 0.1164 1.0000 0.1693 -0.0592 4.0000 0.1693 1.0000 0.2185 -0.0577 5.0000 0.2185 1.0000 0.2637 -0.0552 ZERO NOT FOUND TO DESIRED TOLERANCE s =
  • 24. 0.2637 y = -0.0552 Q10 >> [s,y]=falsi(inline('x^4-0.25'),0,1,0.005,5) step a b s y 1.0000 0 1.0000 0.2500 -0.2461 2.0000 0.2500 1.0000 0.4353 -0.2141 3.0000 0.4353 1.0000 0.5607 -0.1512 4.0000 0.5607 1.0000 0.6344 -0.0880 5.0000 0.6344 1.0000 0.6728 -0.0451 ZERO NOT FOUND TO DESIRED TOLERANCE s = 0.6728 y = -0.0451 Q11 [s,y]=falsi(inline('x^3-9*x+2'),0,1,0.005,8) step a b s y 1.0000 0 1.0000 0.2500 -0.2344 2.0000 0 0.2500 0.2238 -0.0028 regulafalsi methodhasconverged s = 0.2238 y = -0.0028 >> [s,y]=falsi(inline('x^3-9*x+2'),-3,-4,0.005,8) step a b s y 1.0000 -3.0000 -4.0000 -3.0714 0.6680 2.0000 -3.0714 -4.0000 -3.0947 0.2141 3.0000 -3.0947 -4.0000 -3.1021 0.0677 4.0000 -3.1021 -4.0000 -3.1044 0.0213 5.0000 -3.1044 -4.0000 -3.1051 0.0067 6.0000 -3.1051 -4.0000 -3.1054 0.0021 regulafalsi methodhasconverged s = -3.1054 y = 0.0021 >> [s,y]=falsi(inline('x^3-9*x+2'),2,3,0.005,8) step a b s y
  • 25. 1.0000 2.0000 3.0000 2.8000 -1.2480 2.0000 2.8000 3.0000 2.8768 -0.0821 3.0000 2.8768 3.0000 2.8817 -0.0050 4.0000 2.8817 3.0000 2.8820 -0.0003 regulafalsi methodhasconverged s = 2.8820 y = -3.0703e-004 Q12 >> [s,y]=falsi(inline('x^3-2*x^2-5'),2,3,0.005,8) step a b s y 1.0000 2.0000 3.0000 2.5556 -1.3717 2.0000 2.5556 3.0000 2.6691 -0.2338 3.0000 2.6691 3.0000 2.6873 -0.0363 4.0000 2.6873 3.0000 2.6901 -0.0056 5.0000 2.6901 3.0000 2.6906 -0.0008 regulafalsi methodhasconverged s = 2.6906 y = -8.4925e-004 >> [s,y]=falsi(inline('x^3-3*x^2-1'),0,1,0.005,8) ??? Error using==> falsi at 5 functionhassame signat endpoints >> [s,y]=falsi(inline('x^3+3*x^2-1'),0,1,0.005,8) step a b s y 1.0000 0 1.0000 0.2500 -0.7969 2.0000 0.2500 1.0000 0.4074 -0.4344 3.0000 0.4074 1.0000 0.4824 -0.1897 4.0000 0.4824 1.0000 0.5132 -0.0749 5.0000 0.5132 1.0000 0.5250 -0.0284 6.0000 0.5250 1.0000 0.5295 -0.0106 7.0000 0.5295 1.0000 0.5311 -0.0039 regulafalsi methodhasconverged s = 0.5311 y = -0.0039 >> [s,y]=falsi(inline('x^3+3*x^2-1'),-1,0,0.005,8) step a b s y
  • 26. 1.0000 -1.0000 0 -0.5000 -0.3750 2.0000 -1.0000 -0.5000 -0.6364 -0.0428 3.0000 -1.0000 -0.6364 -0.6513 -0.0037 regulafalsi methodhasconverged s = -0.6513 y = -0.0037 >> [s,y]=falsi(inline('x^3+3*x^2-1'),-2,-3,0.005,8) step a b s y 1.0000 -2.0000 -3.0000 -2.7500 0.8906 2.0000 -2.7500 -3.0000 -2.8678 0.0875 3.0000 -2.8678 -3.0000 -2.8784 0.0074 4.0000 -2.8784 -3.0000 -2.8793 0.0006 regulafalsi methodhasconverged s = -2.8793 y = 6.2341e-004 >> [s,y]=falsi(inline('x^3-4*x+1'),0,1,0.005,8) step a b s y 1.0000 0 1.0000 0.3333 -0.2963 2.0000 0 0.3333 0.2571 -0.0116 3.0000 0 0.2571 0.2542 -0.0004 regulafalsi methodhasconverged s = 0.2542 y = -3.8225e-004 >> [s,y]=falsi(inline('x^3-4*x+1'),1,2,0.005,8) step a b s y 1.0000 1.0000 2.0000 1.6667 -1.0370 2.0000 1.6667 2.0000 1.8364 -0.1528 3.0000 1.8364 2.0000 1.8581 -0.0175 4.0000 1.8581 2.0000 1.8605 -0.0020 regulafalsi methodhas converged s = 1.8605 y = -0.0020 >> [s,y]=falsi(inline('x^3-4*x+1'),-2,-3,0.005,8) step a b s y
  • 27. 1.0000 -2.0000 -3.0000 -2.0667 0.4397 2.0000 -2.0667 -3.0000 -2.0951 0.1842 3.0000 -2.0951 -3.0000 -2.1068 0.0756 4.0000 -2.1068 -3.0000 -2.1116 0.0308 5.0000 -2.1116 -3.0000 -2.1136 0.0125 6.0000 -2.1136 -3.0000 -2.1144 0.0051 7.0000 -2.1144 -3.0000 -2.1147 0.0020 regulafalsi methodhasconverged s = -2.1147 y = 0.0020 >> [s,y]=falsi(inline('x^3-x^2-4*x-3'),2,3,0.005,8) step a b s y 1.0000 2.0000 3.0000 2.7000 -1.4070 2.0000 2.7000 3.0000 2.7958 -0.1466 3.0000 2.7958 3.0000 2.8053 -0.0141 4.0000 2.8053 3.0000 2.8062 -0.0013 regulafalsi methodhasconverged s = 2.8062 y = -0.0013 >> [s,y]=falsi(inline('x^3-6*x^2+11*x-5'),2,3,0.005,8) ??? Error using==> falsi at 5 functionhassame signat endpoints >> [s,y]=falsi(inline('x^3-6*x^2+11*x-5'),0,1,0.005,8) step a b s y 1.0000 0 1.0000 0.8333 0.5787 2.0000 0 0.8333 0.7469 0.2854 3.0000 0 0.7469 0.7066 0.1295 4.0000 0 0.7066 0.6887 0.0566 5.0000 0 0.6887 0.6810 0.0243 6.0000 0 0.6810 0.6777 0.0104 7.0000 0 0.6777 0.6763 0.0044 regulafalsi methodhasconverged s = 0.6763 y = 0.0044 >> [s,y]=falsi(inline('6*x^3-23*x^2+20*x'),1,2,0.005,8)
  • 28. step a b s y 1.0000 1.0000 2.0000 1.4286 -0.8746 2.0000 1.0000 1.4286 1.3318 0.0140 3.0000 1.3318 1.4286 1.3334 -0.0002 regulafalsi methodhasconverged s = 1.3334 y = -2.2752e-004 >> [s,y]=falsi(inline('6*x^3-23*x^2+20*x'),2,3,0.005,8) step a b s y 1.0000 2.0000 3.0000 2.2105 -3.3678 2.0000 2.2105 3.0000 2.3553 -2.0900 3.0000 2.3553 3.0000 2.4341 -1.0590 4.0000 2.4341 3.0000 2.4714 -0.4819 5.0000 2.4714 3.0000 2.4879 -0.2086 6.0000 2.4879 3.0000 2.4949 -0.0883 7.0000 2.4949 3.0000 2.4979 -0.0370 8.0000 2.4979 3.0000 2.4991 -0.0155 ZERO NOT FOUND TO DESIRED TOLERANCE s = 2.4991 y = -0.0155 >> [s,y]=falsi(inline('3*x^3-x^2+18*x+6'),0,1,0.005,8) ??? Error using==> falsi at 5 functionhassame signat endpoints >> [s,y]=falsi(inline('3*x^3-x^2-18*x+6'),0,1,0.005,8) step a b s y 1.0000 0 1.0000 0.3750 -0.7324 2.0000 0 0.3750 0.3342 -0.0154 3.0000 0 0.3342 0.3333 -0.0003 regulafalsi methodhasconverged s = 0.3333 y = -2.8549e-004 >> [s,y]=falsi(inline('3*x^3-x^2-18*x+6'),2,3,0.005,8) step a b s y 1.0000 2.0000 3.0000 2.2941 -4.3354 2.0000 2.2941 3.0000 2.4021 -1.4263
  • 29. 3.0000 2.4021 3.0000 2.4357 -0.4261 4.0000 2.4357 3.0000 2.4455 -0.1236 5.0000 2.4455 3.0000 2.4483 -0.0356 6.0000 2.4483 3.0000 2.4492 -0.0102 7.0000 2.4492 3.0000 2.4494 -0.0029 regulafalsi methodhasconverged s = 2.4494 y = -0.0029 >> [s,y]=falsi(inline('3*x^3-x^2-18*x+6'),-2,-3,0.005,8) step a b s y 1.0000 -2.0000 -3.0000 -2.3182 4.9798 2.0000 -2.3182 -3.0000 -2.4152 1.3736 3.0000 -2.4152 -3.0000 -2.4408 0.3517 4.0000 -2.4408 -3.0000 -2.4473 0.0883 5.0000 -2.4473 -3.0000 -2.4489 0.0221 6.0000 -2.4489 -3.0000 -2.4494 0.0055 7.0000 -2.4494 -3.0000 -2.4495 0.0014 regulafalsi methodhasconverged s = -2.4495 y = 0.0014 >> [s,y]=falsi(inline('x^3-x^2-24*x-32'),-1,-2,0.005,8) step a b s y 1.0000 -1.0000 -2.0000 -1.7143 1.1662 2.0000 -1.0000 -1.7143 -1.6397 0.2555 3.0000 -1.0000 -1.6397 -1.6238 0.0523 4.0000 -1.0000 -1.6238 -1.6205 0.0106 5.0000 -1.0000 -1.6205 -1.6198 0.0021 regulafalsi methodhasconverged s = -1.6198 y = 0.0021 >> [s,y]=falsi(inline('x^3-x^2-24*x-32'),5,6,0.005,8) step a b s y 1.0000 5.0000 6.0000 5.9286 -1.0565 2.0000 5.9286 6.0000 5.9435 -0.0142 3.0000 5.9435 6.0000 5.9437 -0.0002 regulafalsi methodhasconverged
  • 30. s = 5.9437 y = -1.9042e-004 >> [s,y]=falsi(inline('x^3-x^2-24*x-32'),-3,-4,0.005,8) step a b s y 1.0000 -3.0000 -4.0000 -3.2000 1.7920 2.0000 -3.2000 -4.0000 -3.2806 0.6655 3.0000 -3.2806 -4.0000 -3.3093 0.2300 4.0000 -3.3093 -4.0000 -3.3191 0.0775 5.0000 -3.3191 -4.0000 -3.3224 0.0259 6.0000 -3.3224 -4.0000 -3.3235 0.0086 7.0000 -3.3235 -4.0000 -3.3238 0.0029 regulafalsi methodhasconverged s = -3.3238 y = 0.0029 >> [s,y]=falsi(inline('x^3-7*x^2+14*x-7'),0,1,0.005,8) step a b s y 1.0000 0 1.0000 0.8750 0.5605 2.0000 0 0.8750 0.8101 0.2793 3.0000 0 0.8101 0.7790 0.1310 4.0000 0 0.7790 0.7647 0.0597 5.0000 0 0.7647 0.7583 0.0269 6.0000 0 0.7583 0.7554 0.0120 7.0000 0 0.7554 0.7541 0.0054 8.0000 0 0.7541 0.7535 0.0024 regulafalsi methodhasconverged s = 0.7535 y = 0.0024 >> [s,y]=falsi(inline('x^3-7*x^2+14*x-7'),3,4,0.005,8) step a b s y 1.0000 3.0000 4.0000 3.5000 -0.8750 2.0000 3.5000 4.0000 3.7333 -0.2634 3.0000 3.7333 4.0000 3.7889 -0.0531 4.0000 3.7889 4.0000 3.7996 -0.0098 5.0000 3.7996 4.0000 3.8015 -0.0018 regulafalsi methodhasconverged s =
  • 31. 3.8015 y = -0.0018 THOMAS METHOD a=[2,4,3,0] a = 2 4 3 0 >> b=[0,2,1,2] b = 0 2 1 2 >> d=[2,4,3,5] d = 2 4 3 5 >> r=[4,6,7,10] r = 4 6 7 10 >> x=thomas(a,d,b,r) x = 1 1 0 2 >> x = 10.0000 -5.8000 2.2000
  • 32. Question1 >> a=[2,3,0] a = 2 3 0 >> b=[0,1,3] b = 0 1 3 >> d=[1,3,10] d = 1 3 10 >> x=thomas(a,d,b,r) x = 2 4 1 Question3.22 d=[-2,-2,-2,-2] d = -2 -2 -2 -2 >> b=[0,1,1,1] b = 0 1 1 1 >> a=[1,1,1,0]
  • 33. a = 1 1 1 0 >> r=[-1,0,0,0] r = -1 0 0 0 >> x=thomas(a,d,b,r) x = 0.8000 0.6000 0.4000 0.2000 >> r=[33,26,30,15] question3.23 r = 33 26 30 15 >> d=[5,5,5,5] d = 5 5 5 5 >> a=[1,1,1,0] a = 1 1 1 0 >> b=[0,1,1,1] b = 0 1 1 1
  • 34. >> x=thomas(a,d,b,r) x = 6.0000 3.0000 5.0000 2.0000 >> Question3.24 r=[14;-36;-6;14;-9;6] r = 14 -36 -6 14 -9 6 >> d=[-3,4,-1,4,1,2] d = -3 4 -1 4 1 2 >> a=[-4,5,-3,-5,-5,0] a = -4 5 -3 -5 -5 0 >> b=[0,-3,1,0,3,-1] b = 0 -3 1 0 3 -1
  • 35. >> x=thomas(a,d,b,r) x = 2.0000 -5.0000 -2.0000 1.0000 -2.0000 2.0000 >> Question3.25 b=[0,5,5,2,5,1,-2] b = 0 5 5 2 5 1 -2 >> a=[3,-1,-1,1,-1,0,0] a = 3 -1 -1 1 -1 0 0 >> d=[1,-4,-2,3,-3,-1,4] d = 1 -4 -2 3 -3 -1 4 >> r=[19;1;28;0;-25;0;2] r = 19 1 28 0 -25 0 2 >> x=thomas(a,d,b,r) x = 4.0000 5.0000 -1.0000 -1.0000 5.0000 5.0000 3.0000
  • 36. C3.1 d=[-1,4,1,-1,-2,-2,4,2] d = -1 4 1 -1 -2 -2 4 2 b=[0,-1,4,0,-2,-4,2,0] b = 0 -1 4 0 -2 -4 2 0 >> a=[1,1,3,-2,-2,-2,0,0] a = 1 1 3 -2 -2 -2 0 0 >> r=[7,13,-3,-2,-4,-28,26,10] r = 7 13 -3 -2 -4 -28 26 10 >> x=thomas(a,d,b,r) x = -4.0000 3.0000 -3.0000 -4.0000 3.0000 3.0000 5.0000 5.0000 >>
  • 37. questionc3.2 r=[-1;19;20;-1;-19;14;0;-4;-2] r = -1 19 20 -1 -19 14 0 -4 -2 >> a=[1,1,-1,4,5,0,-4,-4,0] a = 1 1 -1 4 5 0 -4 -4 0 >> b=[0,2,3,-4,3,-1,-5,-2,-4] b = 0 2 3 -4 3 -1 -5 -2 -4 >> d=[-1,3,-3,3,3,-5,1,2,2] d = -1 3 -3 3 3 -5 1 2 2 >> x=thomas(a,d,b,r) x = 5.0000 4.0000 -3.0000 1.0000 -4.0000 -2.0000 -2.0000 2.0000 3.0000 Questionc3.3 d=[3,3,1,-4,0,-3,0,0,0,1]
  • 38. d = 3 3 1 -4 0 -3 0 0 0 1 >> a=[-4,5,2,5,-2,-2,-5,-1,1,0] a = -4 5 2 5 -2 -2 -5 -1 1 0 >> b=[0,3,-1,-2,1,5,1,-3,-3,-4] b = 0 3 -1 -2 1 5 1 -3 -3 -4 >> r=[-13,-11,-6,25,6,29,1,0,3,-12] r = -13 -11 -6 25 6 29 1 0 3 -12 >> x=thomas(a,d,b,r) x = Columns1 through9 -3.0000 1.0000 -1.0000 -2.0000 3.0000 -4.0000 -1.0000 -1.0000 3.0000 Column10 -0.0000 >>questiona3.7 a=[1,1,1,1,1,1,0] a = 1 1 1 1 1 1 0
  • 39. >> b=[0,1,1,1,1,1,1] b = 0 1 1 1 1 1 1 >> d=[4,4,4,4,4,4,4] d = 4 4 4 4 4 4 4 >> r=[7.2,11.82,12,0,-12,-11.82,-7.2] r = 7.2000 11.8200 12.0000 0 -12.0000 -11.8200 -7.2000 >> x=thomas(a,d,b,r) x = 1.2986 2.0057 2.4986 0.0000 -2.4986 -2.0057 -1.2986 >> Questiona3.8 d=[-1.99,-1.99,-1.99,-1.99,-1.99,-1.99,-1.99,-1.99,-1.99] d = -1.9900 -1.9900 -1.9900 -1.9900 -1.9900 -1.9900 -1.9900 -1.9900 -1.9900 >> a=[1,1,1,1,1,1,1,1,0] a = 1 1 1 1 1 1 1 1 0 >> b=[0,1,1,1,1,1,1,1,1] b =
  • 40. 0 1 1 1 1 1 1 1 1 >> r=[-0.99;0.002;0.0031;0.0042;0.0055;0.0068;0.0084;0.0103;-0.6874] r = -0.9900 0.0020 0.0031 0.0042 0.0055 0.0068 0.0084 0.0103 -0.6874 >> x=thomas(a,d,b,r) x = 0.9846 0.9694 0.9465 0.9172 0.8830 0.8454 0.8061 0.7672 0.7310 GAUSS SEIDEL METHOD Q P6.1 a=[10 -2 1; -2 10 -2; -2 -5 10] a = 10 -2 1 -2 10 -2 -2 -5 10 >> b=[9;12;18] b =
  • 41. 9 12 18 >> x0=[0;0;0] x0 = 0 0 0 >> tol=0.0001 tol = 1.0000e-004 >> max_it=7 max_it= 7 >> x=seidel(a,b,x0,tol,max_it) i x1 x2 x3 1.0000 0.9000 1.3800 2.6700 2.0000 0.9090 1.9158 2.9397 3.0000 0.9892 1.9858 2.9907 4.0000 0.9981 1.9978 2.9985 5.0000 0.9997 1.9996 2.9998 6.0000 1.0000 1.9999 3.0000 gaussseidel methodconverged x =
  • 42. 1.0000 2.0000 3.0000 >> P6.2 max_it=7 max_it= 7 >> tol=0.0001 tol = 1.0000e-004 >> x0=[0;0;0] x0 = 0 0 0 >> b=[8;4;12] b = 8 4 12 >> a=[8 1 -1;-1 7 -2;2 1 9] a = 8 1 -1 -1 7 -2 2 1 9
  • 43. >> x=seidel(a,b,x0,tol,max_it) i x1 x2 x3 1.0000 1.0000 0.7143 1.0317 2.0000 1.0397 1.0147 0.9895 3.0000 0.9969 0.9966 1.0011 4.0000 1.0006 1.0004 0.9998 5.0000 0.9999 0.9999 1.0000 6.0000 1.0000 1.0000 1.0000 gaussseidel methodconverged x = 1.0000 1.0000 1.0000 >> P6.3 a=[5 -1 0;-1 5 -1;0 -1 5] a = 5 -1 0 -1 5 -1 0 -1 5 >> b=[9;4;-6] b = 9 4 -6 >> x0=[0;0;0]
  • 44. x0 = 0 0 0 >> tol=0.0001 tol = 1.0000e-004 >> max_it=7 max_it= 7 >> x=seidel(a,b,x0,tol,max_it) i x1 x2 x3 1.0000 1.8000 1.1600 -0.9680 2.0000 2.0320 1.0128 -0.9974 3.0000 2.0026 1.0010 -0.9998 4.0000 2.0002 1.0001 -1.0000 5.0000 2.0000 1.0000 -1.0000 gaussseidel methodconverged x = 2.0000 1.0000 -1.0000 >> P6.4 max_it=7
  • 45. max_it= 7 >> tol=0.0001 tol = 1.0000e-004 >> x0=[0;0;0] x0 = 0 0 0 >> b=[3;-4;5] b = 3 -4 5 >> a=[4 1 0;1 3 -1;1 0 2] a = 4 1 0 1 3 -1 1 0 2 >> x=seidel(a,b,x0,tol,max_it) i x1 x2 x3 1.0000 0.7500 -1.5833 2.1250 2.0000 1.1458 -1.0069 1.9271 3.0000 1.0017 -1.0249 1.9991
  • 46. 4.0000 1.0062 -1.0024 1.9969 5.0000 1.0006 -1.0012 1.9997 6.0000 1.0003 -1.0002 1.9998 7.0000 1.0001 -1.0001 2.0000 gaussseidel methoddidnotconverged x = 1.0001 -1.0001 2.0000 >> P6.5 a=[4 1 0;1 3 -1;0 -1 4] a = 4 1 0 1 3 -1 0 -1 4 >> b=[3;4;5] b = 3 4 5 >> x0=[0;0;0] x0 = 0 0 0
  • 47. >> tol=0.0001 tol = 1.0000e-004 >> max_it=7 max_it= 7 >> x=seidel(a,b,x0,tol,max_it) i x1 x2 x3 1.0000 0.7500 1.0833 1.5208 2.0000 0.4792 1.6806 1.6701 3.0000 0.3299 1.7801 1.6950 4.0000 0.3050 1.7967 1.6992 5.0000 0.3008 1.7994 1.6999 6.0000 0.3001 1.7999 1.7000 7.0000 0.3000 1.8000 1.7000 gaussseidel methoddidnotconverged x = 0.3000 1.8000 1.7000 >> P6.6 x0=[0;0;0;0] x0 =
  • 48. 0 0 0 0 max_it=7 max_it= 7 a=[-2 1 0 0 ; 1 -2 1 0; 0 1 -2 1; 0 0 1 -2] a = -2 1 0 0 1 -2 1 0 0 1 -2 1 0 0 1 -2 b=[-1;0;0;0] b = -1 0 0 0 x=seidel(a,b,x0,tol,max_it) i x1 x2 x3 1.0000 0.5000 0.2500 0.1250 0.0625 2.0000 0.6250 0.3750 0.2188 0.1094 3.0000 0.6875 0.4531 0.2813 0.1406 4.0000 0.7266 0.5039 0.3223 0.1611 5.0000 0.7520 0.5371 0.3491 0.1746 6.0000 0.7686 0.5588 0.3667 0.1833
  • 49. 7.0000 0.7794 0.5731 0.3782 0.1891 gaussseidel methoddidnotconverged x = 0.7794 0.5731 0.3782 0.1891 >> P6.7 max_it=7 max_it= 7 >> x0=[0;0;0;0] x0 = 0 0 0 0 >> b=[33;26;30;15] b = 33 26 30 15 a=[5 1 0 0;1 5 1 0;0 1 5 1;0 0 1 5] a = 5 1 0 0 1 5 1 0
  • 50. 0 1 5 1 0 0 1 5 >> tol=0.0001 tol = 1.0000e-004 >> x=seidel(a,b,x0,tol,max_it) i x1 x2 x3 1.0000 6.6000 3.8800 5.2240 1.9552 2.0000 5.8240 2.9904 5.0109 1.9978 3.0000 6.0019 2.9974 5.0009 1.9998 4.0000 6.0005 2.9997 5.0001 2.0000 5.0000 6.0001 3.0000 5.0000 2.0000 gaussseidel methodconverged x = 6.0000 3.0000 5.0000 2.0000 >> P6.8 a=[1 2 0 0;2 6 8 0;0 8 35 18;0 0 18 112] a = 1 2 0 0 2 6 8 0 0 8 35 18 0 0 18 112 >> b=[2 ;6;-10;-112]
  • 51. b = 2 6 -10 -112 tol=0.0001 tol = 1.0000e-004 >> x=seidel(a,b,x0,tol,max_it) i x1 x2 x3 1.0000 2.0000 0.3333 -0.3619 -0.9418 2.0000 1.3333 1.0381 -0.0386 -0.9938 3.0000 -0.0762 1.0769 -0.0208 -0.9967 4.0000 -0.1538 1.0789 -0.0198 -0.9968 5.0000 -0.1579 1.0790 -0.0197 -0.9968 6.0000 -0.1580 1.0789 -0.0197 -0.9968 7.0000 -0.1578 1.0788 -0.0196 -0.9968 gaussseidel methoddidnotconverged x = -0.1578 1.0788 -0.0196 -0.9968 >> P6.9 b=[-3;5;2;3.5]
  • 52. b = -3.0000 5.0000 2.0000 3.5000 >> a=[1 -2 0 0;-2 5 -1 0;0 -1 2 -0.5;0 0 -0.5 1.25] a = 1.0000 -2.0000 0 0 -2.0000 5.0000 -1.0000 0 0 -1.0000 2.0000 -0.5000 0 0 -0.5000 1.2500 >> x=seidel(a,b,x0,tol,100) i x1 x2 x3 1.0000 -3.0000 -0.2000 0.9000 3.1600 2.0000 -3.4000 -0.1800 1.7000 3.4800 3.0000 -3.3600 -0.0040 1.8680 3.5472 4.0000 -3.0080 0.1704 1.9720 3.5888 5.0000 -2.6592 0.3307 2.0626 3.6250 6.0000 -2.3386 0.4771 2.1448 3.6579 gaussseidel methodconverged at95th iteration x = 0.9991 1.9996 2.9998 3.9999 p.6.10a=[4 -8 0 0;-8 18 -2 0;0 -2 5 -1.5;0 0 -1.5 1.75] a =
  • 53. 4.0000 -8.0000 0 0 -8.0000 18.0000 -2.0000 0 0 -2.0000 5.0000 -1.5000 0 0 -1.5000 1.7500 >> b=[-12;22;5;2] b = -12 22 5 2 >> max_it=7 max_it= 7 >> tol=0.0001 tol = 1.0000e-004 >> x0=[0;0;0;0] x0 = 0 0 0 0 >> x=seidel(a,b,x0,tol,max_it) i x1 x2 x3 1.0000 -3.0000 -0.1111 0.9556 1.9619 2.0000 -3.2222 -0.1037 1.5471 2.4689
  • 54. 3.0000 -3.2074 -0.0314 1.7281 2.6241 4.0000 -3.0628 0.0530 1.8084 2.6929 5.0000 -2.8940 0.1369 1.8627 2.7394 6.0000 -2.7261 0.2176 1.9089 2.7790 7.0000 -2.5649 0.2944 1.9515 2.8155 gaussseidel methoddidnotconverged x = -2.5649 0.2944 1.9515 2.8155 p.6.11 >> a=[4 8 0 0;8 18 2 0;0 2 5 1.5;0 0 1.5 1.75] a = 4.0000 8.0000 0 0 8.0000 18.0000 2.0000 0 0 2.0000 5.0000 1.5000 0 0 1.5000 1.7500 >> b=[8;18;0.5;-1.75] b = 8.0000 18.0000 0.5000 -1.7500 >> tol=0.0001 tol =
  • 55. 1.0000e-004 >> x0=[0;0;0;0] x0 = 0 0 0 0 >> max_it=7 max_it= 7 >> x=seidel(a,b,x0,tol,max_it) i x1 x2 x3 1.0000 2.0000 0.1111 0.0556 -1.0476 2.0000 1.7778 0.2037 0.3328 -1.2853 3.0000 1.5926 0.2552 0.3835 -1.3287 4.0000 1.4896 0.2953 0.3805 -1.3261 5.0000 1.4093 0.3314 0.3653 -1.3131 6.0000 1.3373 0.3651 0.3479 -1.2982 7.0000 1.2699 0.3970 0.3307 -1.2834 gaussseidel methoddid notconverged x = 1.2699 0.3970 0.3307 -1.2834
  • 56. p.6.12 a=[1 -2 0 0 0;-2 5 1 0 0;0 1 2 -2 0;0 0 -2 5 1;0 0 0 1 2] a = 1 -2 0 0 0 -2 5 1 0 0 0 1 2 -2 0 0 0 -2 5 1 0 0 0 1 2 >> b=[5;-9;0;3;0] b = 5 -9 0 3 0 >> x0=[0;0;0;0;0] x0 = 0 0 0 0 0 >> x=seidel(a,b,x0,tol,max_it) i x1 x2 x3 1.0000 5.0000 0.2000 -0.1000 0.5600 -0.2800 2.0000 5.4000 0.3800 0.3700 0.8040 -0.4020 3.0000 5.7600 0.4300 0.5890 0.9160 -0.4580 4.0000 5.8600 0.4262 0.7029 0.9728 -0.4864 5.0000 5.8524 0.4004 0.7726 1.0063 -0.5032
  • 57. 6.0000 5.8008 0.3658 0.8234 1.0300 -0.5150 7.0000 5.7316 0.3280 0.8660 1.0494 -0.5247 gaussseidel methoddidnotconverged x = 5.7316 0.3280 0.8660 1.0494 -0.5247 >>p.6.13>> a=[1 -2 0 0 0;-2 6 4 0 0;0 4 9 -0.5 0;0 0 -0.5 1.25 0.5;0 0 0 0.5 3.25] a = 1.0000 -2.0000 0 0 0 -2.0000 6.0000 4.0000 0 0 0 4.0000 9.0000 -0.5000 0 0 0 -0.5000 1.2500 0.5000 0 0 0 0.5000 3.2500 >> b=[5;-2;18;0.5;-2.25] b = 5.0000 -2.0000 18.0000 0.5000 -2.2500 >> max_it=260 max_it= 260 >> x0=[0;0;0;0;0]
  • 58. x0 = 0 0 0 0 0 >> >> max_it=1000 max_it= 1000 >> x=seidel(a,b,x0,tol,max_it) i x1 x2 x3 1.0000 5.0000 1.3333 1.4074 0.9630 -0.8405 2.0000 7.6667 1.2840 1.4829 1.3293 -0.8968 3.0000 7.5679 1.2007 1.5402 1.3748 -0.9038 4.0000 7.4015 1.1070 1.5844 1.3953 -0.9070 5.0000 7.2141 1.0151 1.6264 1.4133 -0.9097 6.0000 7.0302 0.9258 1.6670 1.4307 -0.9124 gaussseidel methodconverged at260th iteration x = 1.0028 -1.9986 2.9994 1.9997 -1.0000 p.6.14 > a=[1 -2 0 0 0 0;-2 6 4 0 0 0;0 4 9 -0.5 0 0;0 0 -0.5 3.25 1.5 0;0 0 0 1.5 1.75 -3;0 0 0 0 -3 13]
  • 59. a = 1.0000 -2.0000 0 0 0 0 -2.0000 6.0000 4.0000 0 0 0 0 4.0000 9.0000 -0.5000 0 0 0 0 -0.5000 3.2500 1.5000 0 0 0 0 1.5000 1.7500 -3.0000 0 0 0 0 -3.0000 13.0000 >> b=[-3;22;35.5;-7.75;4;-33] b = -3.0000 22.0000 35.5000 -7.7500 4.0000 -33.0000 >> x0=[0;0;0;0;0;0] x0 = 0 0 0 0 0 0 >> x=seidel(a,b,x0,tol,300) i x1 x2 x3 1.0000 -3.0000 2.6667 2.7593 -1.9601 3.9658 -1.6233 2.0000 2.3333 2.6049 2.6778 -3.8030 2.7627 -1.9009 3.0000 2.2099 2.6181 2.5696 -3.2644 1.8250 -2.1173 4.0000 2.2362 2.6990 2.5635 -2.8326 1.0840 -2.2883
  • 60. 5.0000 2.3980 2.7570 2.5618 -2.4908 0.4979 -2.4236 6.0000 2.5140 2.7968 2.5630 -2.2201 0.0339 -2.5306 gaussseidel methodconvergedat234th iteration x = 1.0029 2.0014 2.9993 -1.0003 -1.9995 -2.9999 Jacobi method P.6.1 a=[10 -2 1;-2 10 -2;-2 -5 10] a = 10 -2 1 -2 10 -2 -2 -5 10 >> b=[9;12;18] b = 9 12 18 >> xo=[0;0;0] xo= 0 0 0 >> x=jacobi(a,b,xo,tol,20)
  • 61. i x1 x2 x3 1.0000 0.9000 1.2000 1.8000 2.0000 0.9600 1.7400 2.5800 3.0000 0.9900 1.9080 2.8620 4.0000 0.9954 1.9704 2.9520 5.0000 0.9989 1.9895 2.9843 6.0000 0.9995 1.9966 2.9945 7.0000 0.9999 1.9988 2.9982 8.0000 0.9999 1.9996 2.9994 9.0000 1.0000 1.9999 2.9998 10.0000 1.0000 2.0000 2.9999 jacobi methodhasconverged x = 1.0000 2.0000 3.0000 P.6.2 > a=[8 1 -1;-1 7 -2;2 1 9] a = 8 1 -1 -1 7 -2 2 1 9 >> b=[8;4;12] b =
  • 62. 8 4 12 >> x=jacobi(a,b,xo,tol,20) i x1 x2 x3 1.0000 1.0000 0.5714 1.3333 2.0000 1.0952 1.0952 1.0476 3.0000 0.9940 1.0272 0.9683 4.0000 0.9926 0.9901 0.9983 5.0000 1.0010 0.9985 1.0027 6.0000 1.0005 1.0009 0.9999 7.0000 0.9999 1.0001 0.9998 8.0000 1.0000 0.9999 1.0000 jacobi methodhasconverged x = 1.0000 1.0000 1.0000 >>p6.3 b=[9;4;-6] b = 9 4 -6 >> a=[5 -1 0;-1 5 -1;0 -1 5]
  • 63. a = 5 -1 0 -1 5 -1 0 -1 5 >> x=jacobi(a,b,xo,tol,20) i x1 x2 x3 1.0000 1.8000 0.8000 -1.2000 2.0000 1.9600 0.9200 -1.0400 3.0000 1.9840 0.9840 -1.0160 4.0000 1.9968 0.9936 -1.0032 5.0000 1.9987 0.9987 -1.0013 6.0000 1.9997 0.9995 -1.0003 7.0000 1.9999 0.9999 -1.0001 8.0000 2.0000 1.0000 -1.0000 jacobi methodhasconverged x = 2.0000 1.0000 -1.0000 >> >>p6.4 a=[4 1 0;1 3 -1;1 0 2] a = 4 1 0 1 3 -1 1 0 2
  • 64. >> b=[3;-4;5] b = 3 -4 5 >> x=jacobi(a,b,xo,tol,20) i x1 x2 x3 1.0000 0.7500 -1.3333 2.5000 2.0000 1.0833 -0.7500 2.1250 3.0000 0.9375 -0.9861 1.9583 4.0000 0.9965 -0.9931 2.0313 5.0000 0.9983 -0.9884 2.0017 6.0000 0.9971 -0.9988 2.0009 7.0000 0.9997 -0.9987 2.0014 8.0000 0.9997 -0.9994 2.0001 9.0000 0.9999 -0.9998 2.0002 10.0000 1.0000 -0.9999 2.0001 jacobi methodhasconverged x = 1.0000 -1.0000 2.0000 >> P6.5 a=[4 1 0;1 3 -1;0 -1 4]
  • 65. a = 4 1 0 1 3 -1 0 -1 4 >> b=[3;4;5] b = 3 4 5 >> x=jacobi(a,b,xo,tol,20) i x1 x2 x3 1.0000 0.7500 1.3333 1.2500 2.0000 0.4167 1.5000 1.5833 3.0000 0.3750 1.7222 1.6250 4.0000 0.3194 1.7500 1.6806 5.0000 0.3125 1.7870 1.6875 6.0000 0.3032 1.7917 1.6968 7.0000 0.3021 1.7978 1.6979 8.0000 0.3005 1.7986 1.6995 9.0000 0.3003 1.7996 1.6997 10.0000 0.3001 1.7998 1.6999 11.0000 0.3001 1.7999 1.6999 jacobi methodhasconverged x =
  • 66. 0.3000 1.8000 1.7000 >> P6.6 b=[-1;0;0;0] b = -1 0 0 0 >> a=[-2 1 0 0;1 -2 1 0;0 1 -2 1;0 0 1 -2] a = -2 1 0 0 1 -2 1 0 0 1 -2 1 0 0 1 -2 >> x0=[0;0;0;0] x0 = 0 0 0 0 x=jacobi(a,b,x0,tol,max_it) i x1 x2 x3 x4 1.0000 0.5000 0 0 0 2.0000 0.5000 0.2500 0 0 3.0000 0.6250 0.2500 0.1250 0 4.0000 0.6250 0.3750 0.1250 0.0625
  • 67. 5.0000 0.6875 0.3750 0.2188 0.0625 6.0000 0.6875 0.4531 0.2188 0.1094 7.0000 0.7266 0.4531 0.2813 0.1094 jacobi methoddidnotconverged resultaftermax no. of iterations x = 0.7266 0.4531 0.2813 0.1094 >> P6.7 =[5 1 0 0;1 5 1 0;0 1 5 1;0 0 1 5] a = 5 1 0 0 1 5 1 0 0 1 5 1 0 0 1 5 >> b=[33;26;30;15] b = 33 26 30 15 >> x0=[0;0;0;0] x0 = 0
  • 68. 0 0 0 x=jacobi(a,b,x0,tol,20) i x1 x2 x3 x4 1.0000 6.6000 5.2000 6.0000 3.0000 2.0000 5.5600 2.6800 4.3600 1.8000 3.0000 6.0640 3.2160 5.1040 2.1280 4.0000 5.9568 2.9664 4.9312 1.9792 5.0000 6.0067 3.0224 5.0109 2.0138 6.0000 5.9955 2.9965 4.9928 1.9978 7.0000 6.0007 3.0023 5.0011 2.0014 8.0000 5.9995 2.9996 4.9992 1.9998 9.0000 6.0001 3.0002 5.0001 2.0002 jacobi methodhasconverged x = 6.0000 3.0000 4.9999 2.0000 >>p6.8 a=[1 2 0 0;2 6 8 0;0 8 35 18] a = 1 2 0 0 2 6 8 0 0 8 35 18 >> b=[2;6;-10;-112]
  • 69. b = 2 6 -10 -112 >> x=jacobi(a,b,x0,tol,10) i x1 x2 x3 x4 1.0000 2.0000 1.0000 -0.2857 -1.0000 2.0000 0 0.7143 0 -0.9541 3.0000 0.5714 1.0000 0.0417 -1.0000 4.0000 0 0.7539 0 -1.0067 5.0000 0.4921 1.0000 0.0597 -1.0000 6.0000 0 0.7564 0 -1.0096 7.0000 0.4873 1.0000 0.0606 -1.0000 8.0000 0 0.7568 0 -1.0097 9.0000 0.4865 1.0000 0.0606 -1.0000 10.0000 0 0.7570 0 -1.0097 jacobi methoddidnotconverged resultaftermax no. of iterations x = 0 0.7570 0 -1.0097
  • 70. P6.9 a=[1 -2 0 0;-2 5 -1 0;0 -1 2 -0.5;0 0 -0.5 1.25] a = 1.0000 -2.0000 0 0 -2.0000 5.0000 -1.0000 0 0 -1.0000 2.0000 -0.5000 0 0 -0.5000 1.2500 >> b=[-3;5;2;3.5] b = -3.0000 5.0000 2.0000 3.5000 >> tol=0.001 tol = 1.0000e-003 >> x0=[0;0;0;0] x0 = 0 0 0 0 >> x=jacobi(a,b,x0,tol,200) i x1 x2 x3 x4 1.0000 -3.0000 1.0000 1.0000 2.8000 2.0000 -1.0000 -0.0000 2.2000 3.2000 3.0000 -3.0000 1.0400 1.8000 3.6800
  • 71. 4.0000 -0.9200 0.1600 2.4400 3.5200 5.0000 -2.6800 1.1200 1.9600 3.7760 6.0000 -0.7600 0.3200 2.5040 3.5840 jacobi methodhasconverged at172nd iteration x = 0.9983 1.9996 2.9995 3.9999 >>p6.10 a=[4 -8 0 0;-8 18 -2 0;0 -2 5 -1.5;0 0 -1.5 1.75] a = 4.0000 -8.0000 0 0 -8.0000 18.0000 -2.0000 0 0 -2.0000 5.0000 -1.5000 0 0 -1.5000 1.7500 >> x0=[0;0;0;0] x0 = 0 0 0 0 >> tol=0.001 tol = 1.0000e-003 >> b=[-12;22;5;2]
  • 72. b = -12 22 5 2 x=jacobi(a,b,x0,tol,500) i x1 x2 x3 x4 1.0000 -3.0000 1.2222 1.0000 1.1429 2.0000 -0.5556 0.0000 1.8317 2.0000 3.0000 -3.0000 1.1788 1.6000 2.7129 4.0000 -0.6423 0.0667 2.2854 2.5143 5.0000 -2.8667 1.1907 1.7810 3.1018 6.0000 -0.6186 0.1460 2.4068 2.6694 jacobi methodhasconverged at310th iteration x = 0.4987 1.7498 2.7496 3.4999 >> P6.11 b=[8;18;0.5;-1.75] b = 8.0000 18.0000 0.5000 -1.7500 >> tol=0.001
  • 73. tol = 1.0000e-003 >> x0=[0;0;0;0] x0 = 0 0 0 0 >> a=[4 8 0 0;8 18 2 0;0 2 5 1.5;0 0 1.5 1.75] a = 4.0000 8.0000 0 0 8.0000 18.0000 2.0000 0 0 2.0000 5.0000 1.5000 0 0 1.5000 1.7500 >> x=jacobi(a,b,x0,tol,500) i x1 x2 x3 x4 1.0000 2.0000 1.0000 0.1000 -1.0000 2.0000 0 0.1000 -0.0000 -1.0857 3.0000 1.8000 1.0000 0.3857 -1.0000 4.0000 0 0.1571 -0.0000 -1.3306 5.0000 1.6857 1.0000 0.4363 -1.0000 6.0000 0 0.2023 -0.0000 -1.3740 jacobi methodhasconverge at 300th iteration x =
  • 74. 0.0008 1.0000 0.0002 -1.0000 >>p6.12 a=[1 -2 0 0 0;-2 5 1 0 0;0 1 2 -2 0;0 0 -2 5 1;0 0 0 1 2] a = 1 -2 0 0 0 -2 5 1 0 0 0 1 2 -2 0 0 0 -2 5 1 0 0 0 1 2 >> b=[5;-9;0;3;0] b = 5 -9 0 3 0 x=jacobi(a,b,x0,tol,1000) i x1 x2 x3 x4 1.0000 5.0000 -1.8000 0 0.6000 0 2.0000 1.4000 0.2000 1.5000 0.6000 -0.3000 3.0000 5.4000 -1.5400 0.5000 1.2600 -0.3000 4.0000 1.9200 0.2600 2.0300 0.8600 -0.6300 5.0000 5.5200 -1.4380 0.7300 1.5380 -0.4300 6.0000 2.1240 0.2620 2.2570 0.9780 -0.7690 jacobi methodhasconverged at968th iteration
  • 75. x = 1.0011 -1.9998 2.9995 1.9999 -0.9999 p.6.13 >> a=[1 -2 0 0 0;-2 6 4 0 0;0 4 9 -0.5 0;0 0 -0.5 1.25 0.5;0 0 0 0.5 3.25] a = 1.0000 -2.0000 0 0 0 -2.0000 6.0000 4.0000 0 0 0 4.0000 9.0000 -0.5000 0 0 0 -0.5000 1.2500 0.5000 0 0 0 0.5000 3.2500 >> b=[5;-2;18;0.5;-2.25] b = 5.0000 -2.0000 18.0000 0.5000 -2.2500. x=jacobi(a,b,x0,tol,500) i x1 x2 x3 x4 1.0000 5.0000 -0.3333 2.0000 0.4000 -0.6923 2.0000 4.3333 -0.0000 2.1704 1.4769 -0.7538 3.0000 5.0000 -0.3358 2.0821 1.5697 -0.9195 4.0000 4.3284 -0.0547 2.2365 1.6006 -0.9338 5.0000 4.8906 -0.3815 2.1132 1.6681 -0.9386 6.0000 4.2370 -0.1120 2.2622 1.6207 -0.9489
  • 76. jacobi methodhasconverged at436th iteration x = 1.0059 -1.9975 2.9987 1.9995 -0.9999 >>p6.14 a=[1 -2 0 0 0 0;-2 6 4 0 0 0;0 4 9 -0.5 0 0;0 0 -0.5 3.25 1.5 0;0 0 0 1.5 1.75 -3;0 0 0 0 -3 13] a = 1.0000 -2.0000 0 0 0 0 -2.0000 6.0000 4.0000 0 0 0 0 4.0000 9.0000 -0.5000 0 0 0 0 -0.5000 3.2500 1.5000 0 0 0 0 1.5000 1.7500 -3.0000 0 0 0 0 -3.0000 13.0000 >> b=[-3;22;35.5;-7.75;4;-33] b = -3.0000 22.0000 35.5000 -7.7500 4.0000 -33.0000 >> x0=[0;0;0;0;0;0] x0 = 0 0 0 0
  • 77. 0 0 >> x=jacobi(a,b,x0,tol,500) i x1 x2 x3 x4 1.0000 -3.0000 3.6667 3.9444 -2.3846 2.2857 -2.5385 2.0000 4.3333 0.0370 2.1823 -2.8327 -0.0220 -2.0110 3.0000 -2.9259 3.6562 3.7706 -2.0387 1.2664 -2.5435 4.0000 4.3124 0.1776 2.2062 -2.3890 -0.3271 -2.2462 5.0000 -2.6448 3.6334 3.7328 -1.8942 0.4827 -2.6140 6.0000 4.2667 0.2966 2.2244 -2.0331 -0.5717 -2.4271 jacobi methoddidnotconverged resultaftermax no. of iterations x = 1.0028 1.9989 2.9994 -0.9997 -1.9995 -3.0001 jacobi methodhasconverged at622nd iteration x = 0.9996 2.0002 3.0001 -1.0001 -2.0001 -3.0000 p.6.18
  • 78. >> a=[10 0 1 0 0 0 0 0;0 10 0 0 0 0 -1 0;0 0 10 0 0 -2 0 0;2 0 0 10 0 0 0 0;0 0 1 0 10 0 0 0;0 0 0 -3 0 10 0 0;0 3 0 0 0 0 10 0;0 0 0 0 1 0 0 10] a = 10 0 1 0 0 0 0 0 0 10 0 0 0 0 -1 0 0 0 10 0 0 -2 0 0 2 0 0 10 0 0 0 0 0 0 1 0 10 0 0 0 0 0 0 -3 0 10 0 0 0 3 0 0 0 0 10 0 0 0 0 0 1 0 0 10 > b=[13;13;18;42;53;48;76;85] b = 13 13 18 42 53 48 76 85 >> x0=[0;0;0;0;0;0;0;0] x0 = 0 0 0 0 0 0 0 0 >> x=jacobi(a,b,x0,tol,1000) i x1 x2 x3 x4 1.0000 1.3000 1.3000 1.8000 4.2000 5.3000 4.8000 7.6000 8.5000
  • 79. 2.0000 1.1200 2.0600 2.7600 3.9400 5.1200 6.0600 7.2100 7.9700 3.0000 1.0240 2.0210 3.0120 3.9760 5.0240 5.9820 6.9820 7.9880 4.0000 0.9988 1.9982 2.9964 3.9952 4.9988 5.9928 6.9937 7.9976 5.0000 1.0004 1.9994 2.9986 4.0002 5.0004 5.9986 7.0005 8.0001 6.0000 1.0001 2.0001 2.9997 3.9999 5.0001 6.0001 7.0002 8.0000 jacobi methodhasconverged x = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000
  翻译: