public static double[] gauss(double[][] a, double b[]) {
        int n = b.length;
        //proceso descendente
        double aux;
        for (int k = 0; k < n; k++) {
            aux = a[k][k];
            for (int j = k; j < n; j++)
                a[k][j] = a[k][j] / aux;
            b[k] = b[k] / aux;
            for (int i = k + 1; i < n; i++) {
                aux = a[i][k];
                for (int j = k; j < n; j++)
                    a[i][j] = a[i][j] - aux * a[k][j];
                b[i] = b[i] - aux * b[k];
            }
        }

        // proceso ascendente
        double[] x = new double[n];
        double suma;
        x[n - 1] = b[n - 1];
        for (int i = n - 2; i >= 0; i--) {
            suma = 0;
            for (int j = i + 1; j < n; j++)
                suma = suma + a[i][j] * x[j];
            x[i] = b[i] - suma;
        }
        return x;
    }