MathGroup Archive 1995

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: simplex tableau help wanted

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg855] Re: simplex tableau help wanted
  • From: rubin at msu.edu (Paul A. Rubin)
  • Date: Wed, 26 Apr 1995 00:22:24 -0400
  • Organization: Michigan State University

In article <3n1sl9$avv at news0.cybernetics.net>,
   gwyn at arl.mil (Doug Gwyn ) wrote:
->I'm a newcomer to Mathematica (Windows) and would appreciate some
->assistance in a project I'm working on, to teach linear programming.
->What I want is to show each tableau in an example of Danzig's simplex
->algorithm, preferably with pivot flagged (*) etc., certainly with
->variable labels along the top and side of the matrix.  Could some
->experienced Mathematica programmer suggest the general structures
->to use for this?  If there is a sample package that does something
->very similar, I'd appreciate finding it.  Thanks for any and all help!

Something like this?

In[1]:=  a = Table[ Random[], {2}, {3} ]
Out[1]=  {{0.949803, 0.734982, 0.254951}, {0.732314, 0.357689, 0.270374}}
In[2]:=  a = ReplacePart[ a, a[[2,2]] "*", {2,2} ]
Out[2]=  {{0.949803, 0.734982, 0.254951}, {0.732314, 0.357689 *, 0.270374}}
In[3]:=  rlabels = {"r1", "r2"}; clabels = {"", "x", "y", "z"};
In[4]:=  aa = 
           Prepend[ Transpose[ Prepend[ Transpose[ a ], rlabels ] ], 
                    clabels 
           ];
In[5]:=  aa // TableForm
Out[5]=
     x          y            z
r1   0.949803   0.734982     0.254951
r2   0.732314   0.357689 *   0.270374

Line 2 puts an asterisk (or any symbol you prefer) next to the pivot entry.
Line 3 defines row and column labels.  Note that the upper left corner 
needs a label, even if it's null (hence the "" column label).
Line 4 puts the table together and line 5 prints it.

Two limitations:  first, I didn't bother to center the labels, although I'm 
pretty sure you can do that with TableForm[]; and second, I don't know 
off-hand if you can prevent TableForm from wrapping each line if the number 
of columns exceeds the width of a printed line.

Paul

**************************************************************************
* Paul A. Rubin                                  Phone: (517) 432-3509   *
* Department of Management                       Fax:   (517) 432-1111   *
* Eli Broad Graduate School of Management        Net:   RUBIN at MSU.EDU    *
* Michigan State University                                              *
* East Lansing, MI  48824-1122  (USA)                                    *
**************************************************************************
Mathematicians are like Frenchmen:  whenever you say something to them,
they translate it into their own language, and at once it is something
entirely different.                                    J. W. v. GOETHE


  • Prev by Date: Re: A Mathematica Puzzle Involving Computation of Expected Utilities
  • Next by Date: Re: matrix evaluation
  • Previous by thread: simplex tableau help wanted
  • Next by thread: Strange answer from Eigensystem[]!