Calculator and Computer Information

This page contains information about using a calculator or computer to solve some of the problems we've discussed in this class .

Solving linear systems using a calculator

Some calculators can find the reduced row-echelon form of a matrix. For example, the TI-85 has an rref command (although for some reason it does not work on matrices with more rows than columns). Check your manual to see if your calculator has this capability.

Solving least-squares problems using a calculator

Many calculators (for example, the TI-85 and TI-82 ) can solve least-squares problems. Look under "linear regression" in the index of your manual.

Solving linear programming problems using LINDO

You can download the Windows version of LINDO for free.

To solve a linear programming problem, start with a new document in LINDO (there will probably a new document open on startup; otherwise, choose New from the File menu). Consider the following example:

   maximize P=2x+3y+4z
   subject to the constraints
      4x-3y+z <= 10
      2x+y-z <= 20
      x+y+z <= 100
      x,y,z >= 0

Enter this problem in LINDO as follows:
max 2x+3y+4z
st
4x-3y+z<10
2x+y-z<20
x+y+z<100
end
Then choose the Solve command from the Solve menu.

You can instead control the pivoting yourself and view the intermediate tableaus using the following procedure:
(1) First use the Compile Model command from the Solve menu to reset the problem. Then choose Tableau from the Reports menu to view the initial tableau (which appears in a separate window).
(2) Return to your document which has the problem statement and choose Pivot from the Solve menu. Lindo will give you a dialog box allowing you to choose the pivot element if you wish. After clicking OK, a new message box will appear, which you can then close, and then also go ahead and close the Pivot dialog box by clicking Cancel. Now choose Tableau again to see the next tableau.
(3) Keep repeating this Pivot - Tableau procedure until you arrive at the final tableau, and then choose Solve for the final answer. The solution for this problem is a maximum of 377.5 at x=0, y=22.5, and z=77.5.

Notes: (1) If you don't specify the pivot yourself, then LINDO may choose a different pivot element than we use in class. This is because LINDO uses a slightly revised version of the Simplex method.
(2) When starting a new problem, use the Compile Model command. This appears to clear the old problem from LINDO's memory. However, if you start to get weird results, you might just want to quit and then restart LINDO.

Solving linear programming problems using EXCEL or QUATTRO PRO

It is very easy to solve linear programming problems using the spreadsheet programs Excel or Quattro Pro. In both programs, you first set up some information in a blank spreadsheet. Then in Excel, use the Solver (in the Tools Menu) to finalize the setup of the problem and obtain the solution. I will describe the procedure to use for Excel in detail below. The procedure for Quattro Pro is very similar, but you use the Optimizer (in the Tools menu) instead of the Solver. Let's work with the same example as we did above with Lindo:

   maximize P=2x+3y+4z
   subject to the constraints
      4x-3y+z <= 10
      2x+y-z <= 20
      x+y+z <= 100
      x,y,z >= 0
Start with with a blank speadsheet in Excel. The cells A1, A2, and A3 will play the role of the variables x, y, and z. The first thing you must do is enter a preliminary value of 0 in each of these three cells. Now move to cell B1 and enter the formula for P as follows:
=2*A1+3*A2+4*A3
and press the Enter key (if you then see a value of 0 in B1, you might want to toggle to "formula mode" by pressing the Ctrl-` key, but this is not necessary). Now enter the formulas for the left sides of the nontrivial contraints into cells B2, B3, and B4, as follows:
=4*A1+-3*A2+A3
=2*A1+A2-A3
=A1+A2+A3
At this point your spreadsheet should look like

Now open the Solver under the Tools menu (if the Solver does not appear in the Tools menu, first go to Add-Ins under the Tools menu and then click on the Solver to add it to the menu; if the Solver also does not appear in Add-Ins, you will have to go back to the Office Setup program to install the Solver). Once the Solver is loaded, you will see a dialog box. Enter B1 in the Set Target Cell: blank, enter A1:A3 (the range for the variables) in the By Changing Cells: blank, and click on the Max button. The dialog should now look like

Now under Subject to the Contraints:, click on Add. You will see another dialog box. Add the constraints one at a time as follows. Enter

B2 <= 10
as in this picture:

and then click Add. Then add the other constraints (3 <= 20, B4 <= 100, A1:A3 >=0) in the same way, and click OK. This will return you to the first dialog, which now looks like

Finally, click on the Solve button. As in the picture below, the values of x, y, and z at which the maximum occurs now appear in cells A1, A2, and A3, and the maximum value appears in cell B1 (toggle back to "value mode" by pressing Ctrl-`). In addition, you can also highlight Answer after pressing Solve, and you will then get a new "Answer Report 1" spreadsheet will details the solution. The solution for this problem is a maximum of 377.5 at x=0, y=22.5, and z=77.5.

Using a calculator to help with counting problems

Most calculators have a factorial (!) button. Some calculators also have built-in functions for permutations and combinations (check your manual). For example, on the TI-85, to access the factorial, permutation, and combination functions, first press the MATH key, and then the PROB submenu. Then to compute C(10,6), for example, press the following keys:

1 0 nCr 6 ENTER

Math 150 home page