[rochester] / trunk / rochester_problib / instructiveProblems / OldProblems / Sets_2.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /trunk/rochester_problib/instructiveProblems/OldProblems/Sets_2.pg

Thu Jul 19 16:22:01 2007 UTC (5 years, 10 months ago) by gage
File size: 3228 byte(s)
```A collection of problems illustrating how to use MathObjects when
writing WeBWorK questions.
```

```    1 ##DESCRIPTION
2 # Name of the file: Sets_2.pg
3 # File Created: 6/29/05
4 # Problem Author: Modified by Shafiu Jibrin
5 #                 from setSets/ur_st_1_2.pg
6
7 # Location: Northern Arizona University
8 # Course:
9 # Recommended trials:
10 # Recommended value:
11 #
12 ##ENDDESCRIPTION
13
14 ##KEYWORDS('Sets')
15
16 DOCUMENT();        # This should be the first executable line in the problem.
17
19 "PGasu.pl",
20 "PG.pl",
21 "PGbasicmacros.pl",
22 "PGchoicemacros.pl",
24 "PGgraphmacros.pl",
26 "PGcourse.pl",
27 # "source.pl",
28 );
29
30 TEXT(&beginproblem);
32
33 ###################
34 #
35 #  Setup
36
37 @slice = NchooseK(12,9);
38 @A = (\$slice[1], \$slice[2], \$slice[3], \$slice[4], \$slice[5]);
39 @B = (\$slice[1], \$slice[2], \$slice[3], \$slice[6]);
40 @C = (\$slice[1], \$slice[4], \$slice[6], \$slice[7], \$slice[8], \$slice[0]);
41 @AiB = (\$slice[1], \$slice[2], \$slice[3]);
42 @AuB = (\$slice[1], \$slice[2], \$slice[3], \$slice[4], \$slice[5], \$slice[6]);
43 @BUCiA = (\$slice[1], \$slice[2], \$slice[3], \$slice[4]);
44 @BuCIA = (\$slice[1], \$slice[2], \$slice[3], \$slice[4], \$slice[6]);
45
46 for (\$k=4; \$k>0; \$k-=1) {
47   for (\$i=0; \$i<\$k; \$i+=1){
48     if(\$A[\$i]>\$A[\$k]) {
49        \$b = \$A[\$i];
50        \$A[\$i] = \$A[\$k];
51        \$A[\$k] = \$b;
52     }
53   }
54 }
55
56 for (\$k=3; \$k>0; \$k-=1) {
57   for (\$i=0; \$i<\$k; \$i+=1){
58     if(\$B[\$i]>\$B[\$k]) {
59        \$b = \$B[\$i];
60        \$B[\$i] = \$B[\$k];
61        \$B[\$k] = \$b;
62     }
63   }
64 }
65
66 for (\$k=5; \$k>0; \$k-=1) {
67   for (\$i=0; \$i<\$k; \$i+=1){
68     if(\$C[\$i]>\$C[\$k]) {
69        \$b = \$C[\$i];
70        \$C[\$i] = \$C[\$k];
71        \$C[\$k] = \$b;
72     }
73   }
74 }
75
76 for (\$k=2; \$k>0; \$k-=1) {
77   for (\$i=0; \$i<\$k; \$i+=1){
78     if(\$AiB[\$i]>\$AiB[\$k]) {
79        \$b = \$AiB[\$i];
80        \$AiB[\$i] = \$AiB[\$k];
81        \$AiB[\$k] = \$b;
82     }
83   }
84 }
85
86 for (\$k=5; \$k>0; \$k-=1) {
87   for (\$i=0; \$i<\$k; \$i+=1){
88     if(\$AuB[\$i]>\$AuB[\$k]) {
89        \$b = \$AuB[\$i];
90        \$AuB[\$i] = \$AuB[\$k];
91        \$AuB[\$k] = \$b;
92     }
93   }
94 }
95
96 for (\$k=3; \$k>0; \$k-=1) {
97   for (\$i=0; \$i<\$k; \$i+=1){
98     if(\$BUCiA[\$i]>\$BUCiA[\$k]) {
99        \$b = \$BUCiA[\$i];
100        \$BUCiA[\$i] = \$BUCiA[\$k];
101        \$BUCiA[\$k] = \$b;
102     }
103   }
104 }
105
106 for (\$k=4; \$k>0; \$k-=1) {
107   for (\$i=0; \$i<\$k; \$i+=1){
108     if(\$BuCIA[\$i]>\$BuCIA[\$k]) {
109        \$b = \$BuCIA[\$i];
110        \$BuCIA[\$i] = \$BuCIA[\$k];
111        \$BuCIA[\$k] = \$b;
112     }
113   }
114 }
115
116 \$LEFT_BRACE = '\{';
117 \$RIGHT_BRACE = '\}';
118
119 ###################
120 #
121 #  Text
122
123 BEGIN_TEXT
124
125 Let \( A= \${LEFT_BRACE} \$A[0],  \$A[1], \$A[2], \$A[3],  \$A[4] \${RIGHT_BRACE}\) , \$SPACE
126 \( B= \${LEFT_BRACE} \$B[0],  \$B[1],  \$B[2],  \$B[3]  \${RIGHT_BRACE}\) , \$SPACE
127 \( C= \${LEFT_BRACE} \$C[0],  \$C[1],  \$C[2], \$C[3], \$C[4], \$C[5] \${RIGHT_BRACE}\). \$BR
128 List the elements of the following sets. If there is more than one element
129 write them separated by commas. \$BR
130
131 \( A \cap B = \${LEFT_BRACE} \) \{ans_rule(25)\}
132 \(\${RIGHT_BRACE}\) \$BR
133
134 \( A \cup B = \${LEFT_BRACE} \) \{ans_rule(25)\} \(\${RIGHT_BRACE}\) \$BR
135
136 \( (B \cup C) \cap A = \${LEFT_BRACE} \) \{ans_rule(25)\} \(\${RIGHT_BRACE}\) \$BR
137
138 END_TEXT
139
140 ###################
141 #