Set A
Set A
"c="0.5177569389343262
"f[c]="1.292135901942437 × 10-6
"Value of h="0.1`
2
"Value of h="0.1`
In[5]:= f[x_ , y _] = - 2 * y + 3
yi = RK4[0, 1, 0.5, f, 1];
3-2y
In[119]:=
Clear[A, b, x, n, m, k, i, m1, m2]
A = N[{{5, 1, 2}, {- 3, 9, 4}, {1, 2, - 7}}];
b = {10, - 14, - 33};
x0 = {0, 0, 0};
xk = x0;
m1 = Length[A];
m2 = Length[b];
k = 0;
Ifm1 ≠ m2, Print"Solution not possible", OutputDetails = {xk};
xk1 = Table[0, {m1}];
Whilek ≤ 10,
k ++;
Fori = 1, i ≤ m1, i ++,
xk1i =
1 Ai, i bi - SumAi, j * xk1j, j, 1, i - 1 - SumAi, j * xkj, j, i + 1, m1;;
OutputDetails = Append[OutputDetails, xk1];
xk = xk1;;
colHeading = Tablei, i, 1, m1;
rowHeading = Tablej, j, 0, k;
PrintNumberForm
TableFormOutputDetails,
TableHeadings → rowHeading, colHeading, 6;
Print"Roots after", k, "iterations are", NumberForm[xk1, 9]
1 2 3
0 0 0 0
1 2. -0.888889 4.74603
2 0.279365 -3.57178 3.73369
3 1.22088 -2.80801 4.08641
4 0.927039 -3.06272 3.97166
5 1.02388 -2.97944 4.00929
6 0.992174 -3.00674 3.99696
7 1.00256 -2.99779 4.001
8 0.99916 -3.00072 3.99967
9 1.00028 -2.99976 4.00011
10 0.99991 -3.00008 3.99996
11 1.00003 -2.99997 4.00001