% % Written by: % -- % John L. Weatherwax 2007-07-01 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- clc; %%%format rat; tab = [ 2, -3, 1, -1, 1, 0, 0, 6 ; 1, 2, -1, 2, 0, 1, 0, 4; -3, 2, 1, -1, 0, 0, 1, 0 ] % the first column is the pivot column; the first row is the pivot row: tab(1,:) = tab(1,:)/2; tab(2,:) = -tab(1,:) + tab(2,:); tab(3,:) = 3*tab(1,:) + tab(3,:); tab % the second column is the pivot column; the second row is the pivot row: tab(2,:) = (2/7) * tab(2,:); tab(1,:) = (3/2) * tab(2,:) + tab(1,:); tab(3,:) = (5/2) * tab(2,:) + tab(3,:); tab % the fourth column is the pivot column; the second row is the row: [ 24/7, 2/7 ] ./ [ 4/7, 5/7 ] tab(2,:) = (7/5) * tab(2,:); tab(1,:) = -(4/7) * tab(2,:) + tab(1,:); tab(3,:) = (5/7) * tab(2,:) + tab(3,:); tab % this gives the solution: x_1 = 3.2; x_2 = 0; x_3 = 0; x_4 = 0.4; x_5 = 0; x_6 = 0; z = 10