Eemath 12

Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 19

Jacobi Iteration

1. Find the roots of the given system equations using the Jacobi Iteration and Gauss-Seidel Method. Compare the
iteration result and roots.
5𝑥1 − 𝑥2 + 2𝑥3 = 12
3𝑥1 + 8𝑥2 − 2𝑥3 = −25
𝑥1 + 𝑥2 + 4𝑥3 = 6

10𝑥1 + 2𝑥2 − 𝑥3 = 27
−3𝑥1 − 6𝑥2 + 2𝑥3 = −61.5
𝑥1 + 𝑥2 + 5𝑥3 = −21.5

X Y Z C
A 5 -1 2 12
B 3 8 -2 -25
C 1 1 4 6

iteration x1 x2 x3
0 0 0 0
1 2.4 -3.125 1.5
2 1.175 -3.65 1.68125
3 0.9975 -3.1453125 2.11875
4 0.9234375 -2.969375 2.036953125
5 0.99134375 -2.96205078125 2.011484375
6 1.00299609375 -2.9938828125 1.9926767578125
7 1.004152734375 -3.00295434570313 1.9977216796875
8 1.00032045898437 -3.00212685546875 1.99970040283203
9 0.999694467773437 -3.00019507141113 2.00045159912109
10 0.999780346069336 -2.99977252563477 2.00012515090942
11 0.999995434509277 -2.99988634204865 1.99999804489136
12 1.00002351363373 -2.99999877671814 1.99997272688484
13 1.00001115390244 -3.00001563589144 1.9999938157711
14 0.999999346513272 -3.00000572877064 2.00000112049725
15 0.999998406046972 -2.99999947481816 2.00000159556434
16 0.999999466810631 -2.99999900337653 2.0000002671928
17 1.00000009244757 -2.99999973325579 1.99999988414147
18 1.00000009969225 -3.00000006363247 1.99999991020205
19 1.00000002319268 -3.00000005983408 1.99999999098505
20 0.999999991639162 -3.00000001095099 2.00000000916035
21 0.999999994145662 -2.9999999945746 2.00000000482796
22 0.999999999153898 -2.99999999659763 2.00000000010723
23 1.00000000063758 -2.9999999996559 1.99999999936093
24 1.00000000032445 -3.00000000039886 1.99999999975458
25 1.0000000000184 -3.00000000018302 2.0000000000186
26 0.999999999955955 -3.00000000000225 2.00000000004116
27 0.999999999983088 -2.99999999997319 2.00000000001157
28 1.00000000000073 -2.99999999999076 1.99999999999753
29 1.00000000000284 -3.00000000000089 1.99999999999751
30 1.00000000000082 -3.00000000000169 1.99999999999951
Method. Compare the

12 + 𝑥2 − 2𝑥3
𝑥1 =
5

−25 − 3𝑥1 + 2𝑥3 X Y


𝑥2 =
8 A 10 2
B -3 -6
6 − 𝑥1 − 𝑥2
𝑥3 = C 1 1
4

iteration x1
0 0
1 2.7
2 0.22
3 0.517666666666667
4 0.5476
5 0.493702222222222
6 0.501046888888889
7 0.501026696296296
8 0.49986701037037
9 0.500038116691358
10 0.500022183051852
11 0.499997405131193
12 0.50000118516349
13 0.500000483006292
14 0.499999955255241
15 0.500000034093899
16 0.50000001067355
17 0.499999999410541
18 0.500000000937839
19 0.50000000024119
20 0.49999999999875
27 − 2𝑥2 + 𝑥3
𝑥1 =
10
Z C
61.5 − 3𝑥1 + 2𝑥3
-1 27 𝑥2 =
6
2 -61.5
5 -21.5 −21.5 − 𝑥1 − 𝑥2
𝑥3 =
5

x2 x3
0 0
10.25 -4.3
7.46666666666667 -6.89
7.84333333333333 -5.83733333333333
8.04538888888889 -5.9722
7.98546666666667 -6.01859777777778
7.99694962962963 -5.99583377777778
8.0008652962963 -5.9995993037037
7.99962021728395 -6.00037839851852
7.99994036197531 -5.99989744553086
8.00001512647737 -5.99999569573333
7.99999034322963 -6.00000746190584
7.99999881013246 -5.99999754967216
8.0000002241942 -5.99999999905919
7.99999975881046 -6.0000001414401
7.99999997522568 -5.99999994281314
8.00000000201534 -6.00000000186392
7.99999999404192 -6.00000000253778
7.9999999994488 -5.99999999869049
7.99999999996758 -6.00000000007733
7.99999999985363 -6.00000000004176
Gauss-Seidel Method

1. Find the roots of the given system equations using the Jacobi Iteration and Gauss-Seidel Method. Compare the
iteration result and roots.
5𝑥1 − 𝑥2 + 2𝑥3 = 12
3𝑥1 + 8𝑥2 − 2𝑥3 = −25
𝑥1 + 𝑥2 + 4𝑥3 = 6

10𝑥1 + 2𝑥2 − 𝑥3 = 27
−3𝑥1 − 6𝑥2 + 2𝑥3 = −61.5
𝑥1 + 𝑥2 + 5𝑥3 = −21.5 12 + 𝑥2
𝑥1 =
5
−25 − 3𝑥
X Y Z C 𝑥2 =
8
A 5 -1 2 12
B 3 8 -2 -25 6 − 𝑥1
𝑥3 =
C 1 1 4 6 4

iteration x1 x2 x3
0 0 0 0
1 2.4 -4.025 1.90625
2 0.8325 -2.960625 2.03203125
3 0.9950625 -2.990140625 1.99876953125
4 1.0024640625 -3.001231640625 1.99969189453125
5 0.9998769140625 -3.00003086914063 2.00003848876953
6 0.999978430664062 -2.99998228930664 2.00000096466064
7 1.00000315627441 -3.00000094243774 1.99999944654083
8 1.00000003289612 -3.00000015070084 2.00000002945118
9 0.999999958079361 -2.99999997691697 2.0000000047094
10 1.00000000273285 -2.99999999984747 1.99999999927866
11 1.00000000031904 -3.00000000029998 1.99999999999523
12 0.999999999941911 -2.99999999997941 2.00000000000937
13 1.00000000000037 -2.99999999999779 1.99999999999936
14 1.0000000000007 -3.00000000000042 1.99999999999993
15 0.999999999999943 -3 2.00000000000001
l Method. Compare the

12 + 𝑥2 − 2𝑥3
𝑥1 =
5
−25 − 3𝑥1 + 2𝑥3
𝑥2 = X Y
8
A 10 2
6 − 𝑥1 − 𝑥2 B -3 -6
𝑥3 =
4 C 1 1

iteration x1
0 0
1 2.7
2 0.258
3 0.523686666666667
4 0.497326022222222
5 0.500253429407408
6 0.499970260315802
7 0.500002685132801
8 0.499999666123976
9 0.50000002801133
10 0.499999996201918
11 0.500000000284862
12 0.499999999956006
13 0.500000000002771
14 0.499999999999478
15 0.500000000000025
Z C
-1 27
2 -61.5
5 -21.5

x2 x3
0 0
8.9 -6.62
7.91433333333333 -5.93446666666667
8.01000111111111 -6.00673755555556
7.99909113703704 -5.99928343185185
8.00011214134568 -6.00007311415062
7.99999049845856 -5.99999215175487
8.00000127351531 -6.00000079172962
7.99999990302814 -5.99999991383042
8.00000001471753 -6.00000000854577
7.99999999905045 -5.99999999905047
8.00000000017408 -6.00000000009179
7.9999999999914 -5.99999999998948
8.00000000000212 -6.00000000000098
7.99999999999994 -5.99999999999988
8.00000000000003 -6.00000000000001
Trapezoidal Rule

a b n h xi f(xi) I (integral) i
0 3 100 0.03 0 1
0.03 1.029563 0.030443 1
0.06 1.058301 0.031318 2
0.09 1.086278 0.032169 3
0.12 1.113553 0.032997 4
0.15 1.140175 0.033806 5
0.18 1.16619 0.034595 6
0.21 1.191638 0.035367 7
0.24 1.216553 0.036123 8
0.27 1.240967 0.036863 9
0.3 1.264911 0.037588 10
0.33 1.28841 0.0383 11
0.36 1.311488 0.038998 12
0.39 1.334166 0.039685 13
0.42 1.356466 0.040359 14
0.45 1.378405 0.041023 15
0.48 1.4 0.041676 16
0.51 1.421267 0.042319 17
0.54 1.442221 0.042952 18
0.57 1.462874 0.043576 19
0.6 1.48324 0.044192 20
0.63 1.50333 0.044799 21
0.66 1.523155 0.045397 22
0.69 1.542725 0.045988 23
0.72 1.56205 0.046572 24
0.75 1.581139 0.047148 25
0.78 1.6 0.047717 26
0.81 1.618641 0.04828 27
0.84 1.637071 0.048836 28
0.87 1.655295 0.049385 29
0.9 1.67332 0.049929 30
0.93 1.691153 0.050467 31
0.96 1.708801 0.050999 32
0.99 1.726268 0.051526 33
1.02 1.74356 0.052047 34
1.05 1.760682 0.052564 35
1.08 1.777639 0.053075 36
1.11 1.794436 0.053581 37
1.14 1.811077 0.054083 38
1.17 1.827567 0.05458 39
1.2 1.843909 0.055072 40
1.23 1.860108 0.05556 41
1.26 1.876166 0.056044 42
1.29 1.892089 0.056524 43
1.32 1.907878 0.057 44
1.35 1.923538 0.057471 45
1.38 1.939072 0.057939 46
1.41 1.954482 0.058403 47
1.44 1.969772 0.058864 48
1.47 1.984943 0.059321 49
1.5 2 0.059774 50
1.53 2.014944 0.060224 51
1.56 2.029778 0.060671 52
1.59 2.044505 0.061114 53
1.62 2.059126 0.061554 54
1.65 2.073644 0.061992 55
1.68 2.088061 0.062426 56
1.71 2.10238 0.062857 57
1.74 2.116601 0.063285 58
1.77 2.130728 0.06371 59
1.8 2.144761 0.064132 60
1.83 2.158703 0.064552 61
1.86 2.172556 0.064969 62
1.89 2.186321 0.065383 63
1.92 2.2 0.065795 64
1.95 2.213594 0.066204 65
1.98 2.227106 0.066611 66
2.01 2.240536 0.067015 67
2.04 2.253886 0.067416 68
2.07 2.267157 0.067816 69
2.1 2.280351 0.068213 70
2.13 2.293469 0.068607 71
2.16 2.306513 0.069 72
2.19 2.319483 0.06939 73
2.22 2.332381 0.069778 74
2.25 2.345208 0.070164 75
2.28 2.357965 0.070548 76
2.31 2.370654 0.070929 77
2.34 2.383275 0.071309 78
2.37 2.39583 0.071687 79
2.4 2.408319 0.072062 80
2.43 2.420744 0.072436 81
2.46 2.433105 0.072808 82
2.49 2.445404 0.073178 83
2.52 2.457641 0.073546 84
2.55 2.469818 0.073912 85
2.58 2.481935 0.074276 86
2.61 2.493993 0.074639 87
2.64 2.505993 0.075 88
2.67 2.517936 0.075359 89
2.7 2.529822 0.075716 90
2.73 2.541653 0.076072 91
2.76 2.553429 0.076426 92
2.79 2.565151 0.076779 93
2.82 2.57682 0.07713 94
2.85 2.588436 0.077479 95
2.88 2.6 0.077827 96
2.91 2.611513 0.078173 97
2.94 2.622975 0.078517 98
2.97 2.634388 0.07886 99
3 2.645751 0.079202 100

5.84004

Compute the absolute relative error Compute the abs


Ea= 0.000681 %
a b n h xi f(xi) I (integral) i
0 6 100 0.06 0 1
0.06 0.996413 0.059892 1
0.12 0.985804 0.059467 2
0.18 0.968617 0.058633 3
0.24 0.945537 0.057425 4
0.3 0.917431 0.055889 5
0.36 0.885269 0.054081 6
0.42 0.850051 0.05206 7
0.48 0.812744 0.049884 8
0.54 0.774234 0.047609 9
0.6 0.735294 0.045286 10
0.66 0.696573 0.042956 11
0.72 0.658588 0.040655 12
0.78 0.621736 0.03841 13
0.84 0.586304 0.036241 14
0.9 0.552486 0.034164 15
0.96 0.5204 0.032187 16
1.02 0.4901 0.030315 17
1.08 0.461595 0.028551 18
1.14 0.434858 0.026894 19
1.2 0.409836 0.025341 20
1.26 0.386458 0.023889 21
1.32 0.364644 0.022533 22
1.38 0.344305 0.021268 23
1.44 0.325351 0.02009 24
1.5 0.307692 0.018991 25
1.56 0.29124 0.017968 26
1.62 0.275908 0.017014 27
1.68 0.261616 0.016126 28
1.74 0.248287 0.015297 29
1.8 0.235849 0.014524 30
1.86 0.224235 0.013803 31
1.92 0.213383 0.013129 32
1.98 0.203236 0.012499 33
2.04 0.193738 0.011909 34
2.1 0.184843 0.011357 35
2.16 0.176504 0.01084 36
2.22 0.16868 0.010356 37
2.28 0.161332 0.0099 38
2.34 0.154426 0.009473 39
2.4 0.147929 0.009071 40
2.46 0.141812 0.008692 41
2.52 0.136047 0.008336 42
2.58 0.13061 0.008 43
2.64 0.125477 0.007683 44
2.7 0.120627 0.007383 45
2.76 0.116042 0.0071 46
2.82 0.111702 0.006832 47
2.88 0.107592 0.006579 48
2.94 0.103696 0.006339 49
3 0.1 0.006111 50
3.06 0.096492 0.005895 51
3.12 0.093158 0.00569 52
3.18 0.08999 0.005494 53
3.24 0.086975 0.005309 54
3.3 0.084104 0.005132 55
3.36 0.08137 0.004964 56
3.42 0.078762 0.004804 57
3.48 0.076275 0.004651 58
3.54 0.073901 0.004505 59
3.6 0.071633 0.004366 60
3.66 0.069466 0.004233 61
3.72 0.067393 0.004106 62
3.78 0.065409 0.003984 63
3.84 0.06351 0.003868 64
3.9 0.06169 0.003756 65
3.96 0.059946 0.003649 66
4.02 0.058274 0.003547 67
4.08 0.056669 0.003448 68
4.14 0.055128 0.003354 69
4.2 0.053648 0.003263 70
4.26 0.052226 0.003176 71
4.32 0.050858 0.003093 72
4.38 0.049543 0.003012 73
4.44 0.048277 0.002935 74
4.5 0.047059 0.00286 75
4.56 0.045885 0.002788 76
4.62 0.044754 0.002719 77
4.68 0.043664 0.002653 78
4.74 0.042612 0.002588 79
4.8 0.041597 0.002526 80
4.86 0.040618 0.002466 81
4.92 0.039672 0.002409 82
4.98 0.038759 0.002353 83
5.04 0.037876 0.002299 84
5.1 0.037023 0.002247 85
5.16 0.036198 0.002197 86
5.22 0.0354 0.002148 87
5.28 0.034628 0.002101 88
5.34 0.03388 0.002055 89
5.4 0.033156 0.002011 90
5.46 0.032455 0.001968 91
5.52 0.031776 0.001927 92
5.58 0.031117 0.001887 93
5.64 0.030479 0.001848 94
5.7 0.02986 0.00181 95
5.76 0.029259 0.001774 96
5.82 0.028676 0.001738 97
5.88 0.02811 0.001704 98
5.94 0.027561 0.00167 99
6 0.027027 0.001638 100

1.405645

Compute the absolute relative error


Ea= 0.308864 %
SIMPSON'S RULE

a b n h xi f(xi) I (integral) i
0 3 100 0.03 0 1
0.03 1.029563 0.061766 1
0.06 1.058301 2
0.09 1.086278 0.06517 3
0.12 1.113553 4
0.15 1.140175 0.068404 5
0.18 1.16619 6
0.21 1.191638 0.071493 7
0.24 1.216553 8
0.27 1.240967 0.074453 9
0.3 1.264911 10
0.33 1.28841 0.0773 11
0.36 1.311488 12
0.39 1.334166 0.080046 13
0.42 1.356466 14
0.45 1.378405 0.082701 15
0.48 1.4 16
0.51 1.421267 0.085273 17
0.54 1.442221 18
0.57 1.462874 0.08777 19
0.6 1.48324 20
0.63 1.50333 0.090197 21
0.66 1.523155 22
0.69 1.542725 0.092561 23
0.72 1.56205 24
0.75 1.581139 0.094866 25
0.78 1.6 26
0.81 1.618641 0.097116 27
0.84 1.637071 28
0.87 1.655295 0.099316 29
0.9 1.67332 30
0.93 1.691153 0.101467 31
0.96 1.708801 32
0.99 1.726268 0.103574 33
1.02 1.74356 34
1.05 1.760682 0.105639 35
1.08 1.777639 36
1.11 1.794436 0.107665 37
1.14 1.811077 38
1.17 1.827567 0.109653 39
1.2 1.843909 40
1.23 1.860108 0.111605 41
1.26 1.876166 42
1.29 1.892089 0.113524 43
1.32 1.907878 44
1.35 1.923538 0.115411 45
1.38 1.939072 46
1.41 1.954482 0.117268 47
1.44 1.969772 48
1.47 1.984943 0.119095 49
1.5 2 50
1.53 2.014944 0.120896 51
1.56 2.029778 52
1.59 2.044505 0.122669 53
1.62 2.059126 54
1.65 2.073644 0.124418 55
1.68 2.088061 56
1.71 2.10238 0.126142 57
1.74 2.116601 58
1.77 2.130728 0.127843 59
1.8 2.144761 60
1.83 2.158703 0.129521 61
1.86 2.172556 62
1.89 2.186321 0.131178 63
1.92 2.2 64
1.95 2.213594 0.132815 65
1.98 2.227106 66
2.01 2.240536 0.134431 67
2.04 2.253886 68
2.07 2.267157 0.136029 69
2.1 2.280351 70
2.13 2.293469 0.137607 71
2.16 2.306513 72
2.19 2.319483 0.139168 73
2.22 2.332381 74
2.25 2.345208 0.140712 75
2.28 2.357965 76
2.31 2.370654 0.142239 77
2.34 2.383275 78
2.37 2.39583 0.143749 79
2.4 2.408319 80
2.43 2.420744 0.145244 81
2.46 2.433105 82
2.49 2.445404 0.146724 83
2.52 2.457641 84
2.55 2.469818 0.148188 85
2.58 2.481935 86
2.61 2.493993 0.149639 87
2.64 2.505993 88
2.67 2.517936 0.151076 89
2.7 2.529822 90
2.73 2.541653 0.152499 91
2.76 2.553429 92
2.79 2.565151 0.153909 93
2.82 2.57682 94
2.85 2.588436 0.155306 95
2.88 2.6 96
2.91 2.611513 0.15669 97
2.94 2.622975 98
2.97 2.634388 0.158063 99
3 2.645751 100

5.840086

Compute the absolute relative error Compute the abs


Et= 0.001479 %
a b n h xi f(xi) I (integral) i
0 6 100 0.06 0 1
0.06 0.996413 0.119429 1
0.12 0.985804 2
0.18 0.968617 0.116116 3
0.24 0.945537 4
0.3 0.917431 0.110011 5
0.36 0.885269 6
0.42 0.850051 0.101964 7
0.48 0.812744 8
0.54 0.774234 0.092899 9
0.6 0.735294 10
0.66 0.696573 0.083603 11
0.72 0.658588 12
0.78 0.621736 0.074637 13
0.84 0.586304 14
0.9 0.552486 0.066333 15
0.96 0.5204 16
1.02 0.4901 0.058848 17
1.08 0.461595 18
1.14 0.434858 0.052217 19
1.2 0.409836 20
1.26 0.386458 0.046406 21
1.32 0.364644 22
1.38 0.344305 0.041344 23
1.44 0.325351 24
1.5 0.307692 0.036947 25
1.56 0.29124 26
1.62 0.275908 0.03313 27
1.68 0.261616 28
1.74 0.248287 0.029812 29
1.8 0.235849 30
1.86 0.224235 0.026923 31
1.92 0.213383 32
1.98 0.203236 0.024401 33
2.04 0.193738 34
2.1 0.184843 0.022192 35
2.16 0.176504 36
2.22 0.16868 0.020251 37
2.28 0.161332 38
2.34 0.154426 0.018539 39
2.4 0.147929 40
2.46 0.141812 0.017024 41
2.52 0.136047 42
2.58 0.13061 0.015679 43
2.64 0.125477 44
2.7 0.120627 0.014481 45
2.76 0.116042 46
2.82 0.111702 0.013409 47
2.88 0.107592 48
2.94 0.103696 0.012447 49
3 0.1 50
3.06 0.096492 0.011582 51
3.12 0.093158 52
3.18 0.08999 0.010802 53
3.24 0.086975 54
3.3 0.084104 0.010095 55
3.36 0.08137 56
3.42 0.078762 0.009454 57
3.48 0.076275 58
3.54 0.073901 0.00887 59
3.6 0.071633 60
3.66 0.069466 0.008338 61
3.72 0.067393 62
3.78 0.065409 0.007851 63
3.84 0.06351 64
3.9 0.06169 0.007404 65
3.96 0.059946 66
4.02 0.058274 0.006994 67
4.08 0.056669 68
4.14 0.055128 0.006617 69
4.2 0.053648 70
4.26 0.052226 0.006268 71
4.32 0.050858 72
4.38 0.049543 0.005946 73
4.44 0.048277 74
4.5 0.047059 0.005648 75
4.56 0.045885 76
4.62 0.044754 0.005371 77
4.68 0.043664 78
4.74 0.042612 0.005114 79
4.8 0.041597 80
4.86 0.040618 0.004875 81
4.92 0.039672 82
4.98 0.038759 0.004652 83
5.04 0.037876 84
5.1 0.037023 0.004443 85
5.16 0.036198 86
5.22 0.0354 0.004249 87
5.28 0.034628 88
5.34 0.03388 0.004066 89
5.4 0.033156 90
5.46 0.032455 0.003895 91
5.52 0.031776 92
5.58 0.031117 0.003734 93
5.64 0.030479 94
5.7 0.02986 0.003584 95
5.76 0.029259 96
5.82 0.028676 0.003441 97
5.88 0.02811 98
5.94 0.027561 0.003308 99
6 0.027027 100

1.405648

Compute the absolute relative error


Et= 0.308677 %

You might also like