Escolar Documentos
Profissional Documentos
Cultura Documentos
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
double D = -((Dx*Dy*Dz*ct*Porosidade)/(Dt*Bo));
double Tx =(Kx)/(Dx*viscosidade*Bo);
double Ty =(Ky)/(Dy*viscosidade*Bo);
double Tz =(Kz)/(Dz*viscosidade*Bo);
*/
public class Gauss_Seidel{
public static final int MAX_ITERATIONS = 100;
private double[][] M;
public Gauss_Seidel(double [][] matrix) { M = matrix; }
M = T;
return true;
}
if (transformToDominant(r + 1, V, R))
return true;
V[i] = false;
}
}
return false;
}
Arrays.fill(visited, false);
while (true)
{
for (int i = 0; i < n; i++)
{
double sum = M[i][n]; // b_n
iterations++;
if (iterations == 1)
continue;
while (strtk.hasMoreTokens())
for (int j = 0; j < n + 1 && strtk.hasMoreTokens(); j++)
M[i][j] = Integer.parseInt(strtk.nextToken());
}
Output:
$ javac Gauss_Seidel.java
$ java Gauss_Seidel
Enter the number of variables in the equation:
2
Enter the augmented matrix:
1 2 3
6 5 4