clear all
A=sym('A');
c0=sym('c0');
b0=sym('b0');
c0=-[1 -1 1 1 1 -1 ]';
b0=[3 4 2]';
A0=[ 
-8 -3 12 1 0 0 
-2 -1 6 0 1 0 
3 1 -4 0 0 1     ];
A=[
    -c0'   0
     A0    b0
  ]
pause
A=piv(A,3,2)
A=piv(A,2,3)
A=piv(A,4,6)
disp('now complete the pivoting to complete new basis')
pause
theta=sym('theta')
A=[
        A(1,1:6)    0       A(1,7)
      A(2:4,1:6) zeros(3,1) A(2:4,7)
     4 2 -6 0 0 0 1         theta
]
A(5,:)=A(5,:)-A(5,2)*A(2,:)
A(5,:)=A(5,:)-A(5,3)*A(3,:)
As=A;
disp('now set theta=-2')
pause
A=subs(A,-2)
disp('leaving:   x_7, pivot row 5')
disp('ratios for columns 1,5 only - tie - use smallest subscr. rule:')
warning off
A(1,:)./A(5,:)
disp(' tie - use smallest subscr. rule:')
disp('x_1 enters - pivot on element 5,1 ')
pause
A=piv(A,5,1)
disp('NOTE: vbar is DECREASING')
disp('row 2 indicates problem is INFEASIBLE')
