given : products and reactants (material balance)
version 1.0 :   (peter.vlasschaert@gmail.com , 12/08/2016)

kill(all)$
x:CH[4];
y:CO[2];
z:CO;
u:H[2];
v:"H[2]O";

reaction set: (find : needed for material balances ?)
  reactants   -> products

1e) '1'CH  + '1'CO  -> '2' CO + '2'H
         4        2                 2
2e) '1'CO +'1'H O  -> '1'CO  + '1' H 
               2           2        2
3e) '1'CH + '1'H O  -> '1'CO + '3' H
         4      2                   2
4e) '1'CH + '2'H O  -> '1'CO  + '4' H 
         4      2           2        2

fill in : Matrix ,row   : reactions 1e),2e),3e),4e)

                           1  2  3  4   5
                         ------------------
                  column: CH ,CO ,CO,H ,H 0
                            4   2     2  2  
number rows    : 4
number columns : 5
reactant : - 'value' , product : + 'value'

r1:-1*x-1*y+2*z+2*u=0;
r2:-1*z-1*v+1*y+1*u=0;
r3:-1*x-1*v+1*z+3*u=0;
r4:-1*x-2*v+1*y+4*u=0;

eqs:[r1,r2,r3,r4];

m1:coefmatrix(eqs,[x,y,z,u,v]);

construct echelon matrix from 'm1'

m2:echelon(m1);

v1:number rows    'm2' = length(m2)
v2:number columns 'm2' = length(transpose(m2));

v1:print("number of rows    'm2' = ",length(m2))$
v2:print("number of columns 'm2' = ",length(transpose(m2)))$

for i:1 step 1 thru length(m2) do
  disp(q[i]:m2[i,1]*x+m2[i,2]*y+m2[i,3]*z+m2[i,4]*u+m2[i,5]*v=0);

result : reaction needed for 'material balances'

         we see above matrix 'echelon(m2)',build in 'Maxima'

     r1: '2'H  + '2' CO -> '1'CH + '1'CO
             2                  4       2
     r2: '1'CO + '1'H O -> '1'CO  + '1'H
                     2          2       2

eqs1:[q[1],q[2]];

info: matrix operations 'see above'

m2[1,3];

row(m2,1);

col(m2,1);

The rank is the order of the largest nonzero subdeterminant
of matrix 'm2'

rank(m2);