[npl] / trunk / NationalProblemLibrary / ASU-topics / set119LinearSystems / p21.pg Repository:
ViewVC logotype

Annotation of /trunk/NationalProblemLibrary/ASU-topics/set119LinearSystems/p21.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 61 - (view) (download)

1 : jj 61 ##DESCRIPTION
2 :     ##KEYWORDS('')
3 :     ##
4 :     ##ENDDESCRIPTION
5 :    
6 :     DOCUMENT(); # This should be the first executable line in the problem.
7 :    
8 :     loadMacros(
9 :     "PGasu.pl",
10 :     "PG.pl",
11 :     "PGbasicmacros.pl",
12 :     "PGchoicemacros.pl",
13 :     "PGanswermacros.pl",
14 :     "PGauxiliaryFunctions.pl",
15 :     "PGmatrixmacros.pl"
16 :     );
17 :    
18 :     TEXT(&beginproblem);
19 :     $showPartialCorrectAnswers = 1;
20 :    
21 :     $a1 = non_zero_random(-9,9,1);
22 :     $b1 = non_zero_random(-99,99,1);
23 :     $c1 = non_zero_random(-99,99,1);
24 :     $d1 = random(-99,99,1);
25 :     $a2 = 0;
26 :     $b2 = non_zero_random(-99,99,1);
27 :     $c2 = non_zero_random(-9,9,1);
28 :     $d2 = random(-9,9,1);
29 :     $a3 = non_zero_random(-99,99,1);
30 :     $b3 = 0;
31 :     $c3 = random(2,99,1);
32 :     $d3 = random(-99,99,1);
33 :     $a4 = random(-9,9,1);
34 :     $b4 = non_zero_random(-9,9,1);
35 :     $c4 = non_zero_random(-99,99,1);
36 :     $d4 = random(-99,99,1);
37 :     $a5 = random(2,99,1);
38 :     $b5 = random(1,99,1);
39 :     $c5 = 0;
40 :     $d5 = random(-9,9,1);
41 :    
42 :     @a = ($a1, $a2, $a3, $a4, $a5);
43 :     @b = ($b1, $b2, $b3, $b4, $b5);
44 :     @c = ($c1, $c2, $c3, $c4, $c5);
45 :     @d = ($d1, $d2, $d3, $d4, $d5);
46 :    
47 :     @mx = ("$a1 x", "", "$a3 x", "$a4 x", "$a5 x");
48 :     @my = ("+$b1 y", "+$b2 y", "", "+$b4 y", "+$b5 y");
49 :     @mz = ("+$c1 z", "+$c2 z", "+$c3 z", "+$c4 z", "");
50 :     @m = ("$d1", "$d2", "$d3", "$d4", "$d5");
51 :    
52 :     $tag1 = random(0,2,1);
53 :     $tag2 = $tag1 +1;
54 :     $tag3 = $tag1 +2;
55 :    
56 :     $NO_SPACE = '@{}';
57 :    
58 :     BEGIN_TEXT
59 :    
60 :     Write the augmented matrix of the system
61 :     \[ \left\{"\{"\} \begin{array}{r${NO_SPACE}r${NO_SPACE}r${NO_SPACE}r${NO_SPACE}r}
62 :     \{join("&",$mx[$tag1],$my[$tag1],$mz[$tag1],"=",$m[$tag1] ) \} \cr
63 :     \{join("&",$mx[$tag2],$my[$tag2],$mz[$tag2],"=",$m[$tag2] ) \} \cr
64 :     \{join("&",$mx[$tag3],$my[$tag3],$mz[$tag3],"=",$m[$tag3] ) \} \cr
65 :     \end{array} \right. \]
66 :    
67 :     $BR
68 :    
69 :     $BCENTER
70 :     \{display_matrix([[ans_rule(5),ans_rule(5),ans_rule(5),ans_rule(5)],
71 :     [ans_rule(5),ans_rule(5),ans_rule(5),ans_rule(5)],
72 :     [ans_rule(5),ans_rule(5),ans_rule(5),ans_rule(5)]],
73 :     'align' =>"ccc|c")
74 :     \}
75 :     $ECENTER
76 :    
77 :    
78 :     END_TEXT
79 :    
80 :    
81 :    
82 :     &ANS(arith_num_cmp($a[$tag1]));
83 :     &ANS(arith_num_cmp($b[$tag1]));
84 :     &ANS(arith_num_cmp($c[$tag1]));
85 :     &ANS(arith_num_cmp($d[$tag1]));
86 :    
87 :     # row 2
88 :     &ANS(arith_num_cmp($a[$tag2]));
89 :     &ANS(arith_num_cmp($b[$tag2]));
90 :     &ANS(arith_num_cmp($c[$tag2]));
91 :     &ANS(arith_num_cmp($d[$tag2]));
92 :    
93 :     # row 3
94 :     &ANS(arith_num_cmp($a[$tag3]));
95 :     &ANS(arith_num_cmp($b[$tag3]));
96 :     &ANS(arith_num_cmp($c[$tag3]));
97 :     &ANS(arith_num_cmp($d[$tag3]));
98 :    
99 :    
100 :    
101 :     ENDDOCUMENT(); # This should be the last executable line in the problem.

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9