[npl] / trunk / NationalProblemLibrary / ASU-topics / set119LPsimplex / p8piv.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /trunk/NationalProblemLibrary/ASU-topics/set119LPsimplex/p8piv.pg

Sat Jan 14 02:13:08 2006 UTC (7 years, 4 months ago) by jj
File size: 1875 byte(s)
```New problems for the library.
```

```    1 ##DESCRIPTION
2 ##   Evaluation of a simple algebraic expression
3 ##ENDDESCRIPTION
4
5 ##KEYWORDS('percent')
6
7 #
8 # First comes some stuff that appears at the beginning of every problem
9 #
10
11 DOCUMENT();        # This should be the first executable line in the problem.
12
14 "PG.pl",
15 "PGbasicmacros.pl",
16 "PGchoicemacros.pl",
18 "PGauxiliaryFunctions.pl",
19 "LinearProgramming.pl",
20 "PGmatrixmacros.pl",
21 "PGasu.pl"
22 );
23
24
25 TEXT(&beginproblem);
28
29 \$tops2 = ['P', 'x_1', 'x_2', 'x_3', 's_1', 's_2', 's_3', '\mbox{\tiny{RHS}}'];
30
31 @base = (1,2,3,4,5,6,7,8,9,10);
32
33 \$a = random(-2, -10);
34 \$b = \$a - random(3, 7);
35 \$bb = \$b - random(3, 10);
36 \$r1 = random(15, 45);
37 \$r2 = random(15, 80);
38 \$a1=random(2,20);
39 do {\$a2 = random(2,20);} until (\$a2*\$r1 != \$a1*\$r2) ;
40
41 \$sys1 = [
42 [0, \$a1, -random(2,20), random(20,20), 1, 0, 0, \$r1],
43 [0, -random(2,20), random(2,20), -random(2,20), 0, 1, 0,random(15, 80)],
44 [0, \$a2, 0, -random(2,20), 0, 0, 1,\$r2],
45 [1, \$bb, \$b, \$a, 0, 0, 0,random(20, 200)]];
46
47 @sl1 = (0, 4,1,6,3,2, 5, 7);
48 @ans1 = (0, 0, 0, \$sys1->[0][5], \$sys1->[1][5],\$sys1->[2][5]);
49 @ans1=@ans1[@sl1];
50 for \$jj (0..3) {
51   \$sys1->[\$jj] = [ @{\$sys1->[\$jj]}[@sl1] ];
52 }
53
54 (\$r, \$c) = lp_pivot_element(\$sys1);
55
56 BEGIN_TEXT
57 Determine the correct pivot element for the following simplex tableau.
58
59   \$BR\$BR
60 \[\{ lp_display_mm(\$sys1, top_labels=>\$tops2) \} \]
61 \$BR\$BR
62 Pivot row number (1, 2, 3, or 4) = \{ ans_rule(10) \}
63 \$BR
64 Pivot column number (1, 2, ... or 8) = \{ ans_rule(10) \}
65 END_TEXT
66
67 #
68 # Tell WeBWork how to test if answers are right.  These should come in the
69 # same order as the answer blanks above.  You tell WeBWork both the type of