Gauss seidel in VBA
Trying to use Gauss seidel method to solve a 25 by 25 matrix to solve a 2D heat transfer chemical engineering problem.
But it doesnt go to 2nd iteration
Do While error > 0.1
temps0 = temps1(UBound(matrix1, 1), 1) ' Old temperature for error calculation
'Conducts the gauss algorithm for each row
For i = 1 To UBound(matrix1, 1)
temps1(i, 1) = matrix1(i, UBound(matrix1, 2))
For j = 1 To (UBound(matrix1, 2)  1)
If j <> i Then
temps1(i, 1) = temps1(i, 1)  (matrix1(i, j) * temps1(j, 1))
ElseIf j = i Then
divider = matrix1(i, j)
End If
Next j
temps1(i, 1) = temps1(i, 1) / divider
Next i
error = Abs((temps1(UBound(matrix1, 1), 1)  temps0) / temps1(UBound(matrix1, 1), 1))
iteration = iteration + 1
Loop
this is the do while loop for Gauss Seidel Matrix1 is coeff matrix generated by previous functions
Really appreciate any help. TY
1 answer

Problem solved by change the value of error, thanks anyway