// simeq.java solve simultaneous equations AX=Y // solve real linear equations for X where Y = A * X // method: Gauss-Jordan elimination using maximum pivot // usage: simeq(A,Y,X); or simeq(n,A,Y,X) // Translated to java by : Jon Squire , 26 March 2003 // First written by Jon Squire December 1959 for IBM 650, translated to // other languages e.g. Fortran converted to Ada converted to C // then converted to java public class simeq { simeq(final double A[][], final double Y[], double X[]) { int n=A.length; double B[][] = new double[n][n+1]; // working matrix if(A[0].length!=n || Y.length!=n || X.length!=n) { System.out.println("Error in simeq, inconsistent array sizes."); } // build working data structure for(int i=0; i abs_pivot) { I_pivot = i; pivot = B[row[i]][k]; abs_pivot = Math.abs(pivot); } } // have pivot, interchange row indicies hold = row[k]; row[k] = row[I_pivot]; row[I_pivot] = hold; // check for near singular if(abs_pivot < 1.0E-20) { for(int j=k+1; j