Hi everyone,
I just updated our WW server from 2.15 to 2.16. My colleague contacted me saying that a problem that worked just fine is now not rendering by the system.
Is there anything that changed with the upgrade that would cause the error with the PG code?
I may be wrong but lines 124 and 125 of the code, which are indicated in the error message, don't seem to be needed. So after commenting them, the problem is rendered when seen it individually on a page of the assignment. Though it is still doesn't show in the Hmwk Set Editor view of the instructor.
I really would like to know why it is now having issues. Is there anything to be adjusted after the upgrade?
Thank you.
-------
WeBWorK Error
Error messages
Error details
Problem11
1. ERROR caught by Translator while processing problem file:MA119/ES/BeforeTest1Graph1.pg
****************
ERRORS from evaluating PG file:
Alias 'R' doesn't exist for string 'All real numbers' at line 124 of (eval 3075)
****************
------Input Read
1 ##DESCRIPTION
2 ## Introduction to Functions
3 ##
4 ##ENDDESCRIPTION
5 ## DBsubject(Algebra)
6 ## DBchapter(Functions)
7 ## DBsection(Domain and range)
8 ## Institution(The College of Idaho)
9 ## Author(RA Cruz)
10 ## MLTleader(1)
11 ## MLT(algebra_functions_domain_range_graph_linear)
12 ## Level(2)
13 ## MO(1)
14 ## TitleText1('Essentials of Intermediate Algebra')
15 ## AuthorText1('Blitzer')
16 ## EditionText1('1')
17 ## Section1('2.1')
18 ## Problem1('')
19 ## KEYWORDS('functions')
20 ## Date: 2007/09 updated 2013/08 -rac
21
22 DOCUMENT(); # This should be the first executable line in the problem.
23
24 loadMacros(
25 "PGstandard.pl",
26 "MathObjects.pl",
27 "contextLimitedNumeric.pl",
28 "contextInequalities.pl",
29 "answerHints.pl",
30 "PGgraphmacros.pl",
31 "PGchoicemacros.pl"
32 );
33
34 TEXT(beginproblem());
35
36 ######################################
37 # Setup
38
39 Context("Numeric");
40
41 #--------Define the function-----------
42
43 @xnum = (random(-5,-3,1),random(3,5,1)); #Stay in the grid
44 @ynum = (random(-5,-3,1),random(3,5,1));
45
46 $m = ($ynum[1] - $ynum[0])/($xnum[1] - $xnum[0]);
47 $b = $ynum[0] - $m * $xnum[0];
48
49 $f = Formula("$m * x + $b");
50
51 @interval = ("[$xnum[0],$xnum[1])","($xnum[0],$xnum[1]]");
52 $n = random(0,1,1);
53
54 #------------Define the graph-----------------------
55 $refreshCachedImages=1;
56
57 $choose = random(0,2,1);
58 @colors = ("blue", "red", "green");
59 $rc = $colors[$choose]; #Pick a random color
60
61 $xmin = -6;
62 $ymin = -6;
63 $xmax = 6;
64 $ymax = 6;
65
66 $graph = init_graph($xmin,$ymin,$xmax,$ymax,
67 'axes'=>[0,0],'grid'=>[$xmax-$xmin,$ymax-$ymin]);
68 $graph->lb('reset');
69 add_functions( $graph,"$f for x in $interval[$n] using color:$rc and weight:3" );
70
71 $graph->lb( new Label($xmin+1,$ymax-.5, "y = f(x)",'black','center') );
72
73 $i = 0; # Number the axes
74 do {
75 $xtick = $i + $xmin + 1;
76 if ($xtick!=0) {$graph->lb( new Label($xtick,0, "$xtick",'black','center') );}
77 $i =$i+1;
78 } while ($i<($xmax-$xmin)-1);
79
80 $i = 0;
81 do {
82 $ytick = $i +$ymin + 1;
83 if ($ytick!=0) {$graph->lb( new Label(-.2,$ytick+.1, "$ytick",'black','center') );}
84 $i =$i+1;
85 } while ($i<($ymax-$ymin)-1);
86
87 #------------Pick the points---------------
88
89 @n = (random($xnum[0]+1,$xnum[1]-1,1), $xnum[$n]);
90 @slice = NchooseK(2,2);
91 @input = @n[@slice];
92 @answer = ($f->eval(x=>$input[0]), $f->eval(x=>$input[1]));
93
94 ######################################
95 # Main text
96 # Note: tex_size=>n is for the size on the hardcopy: 600=60%
97
98 BEGIN_TEXT
99 $BCENTER
100 \{ image( insertGraph($graph),
101 width=>400,height=>400,tex_size=>600 ) \}
102 $ECENTER
103 $BR
104 Use the graph of \(y=f(x)\) given above to find:
105 $PAR
106 a) \( f($input[0]) \) = \{ans_rule(10)\}
107 $PAR
108 b) \( f($input[1]) \) = \{ans_rule(10)\}
109 $PAR
110 $BR
111 Write your answers in interval notation
112 $BR
113 c) The domain: \{ans_rule(20)\}
114 $PAR
115 d) The range: \{ans_rule(20)\}
116 END_TEXT
117
118 ######################################
119 # Answers
120
121 $showPartialCorrectAnswers = 1;
122
123 Context("LimitedNumeric");
124 Context()->strings->add("No solution"=>{alias=>"DNE"},
125 "All real numbers"=>{alias=>"R"});
126
127 #---Part a)--------------------------
128 $ans_a = Real($answer[0])->with(tolerance=>0.15, tolType=>'absolute');
129 ANS($ans_a->cmp(ignoreStrings => 1));
130
131 #---Part b)--------------------------
132 $ans_b = Real($answer[1])->with(tolerance=>0.15, tolType=>'absolute');
133 ANS($ans_b->cmp(ignoreStrings => 1));
134
135 #---Part c)--------------------------
136 Context("Inequalities");
137 Context()->variables->add(y=>'Real');
138 Context()->strings->add("All real numbers"=>{},"R"=>{alias=>"All real numbers"});
139
140 @domain = ("$xnum[0] <= x < $xnum[1]", "$xnum[0] < x <= $xnum[1]");
141 $ans_c = Compute($domain[$n]);
142 ANS($ans_c->cmp->withPostFilter(AnswerHints(
143 sub {
144 my ($correct,$student,$ans) = @_;
145 return $student =~ /y/;
146 } => ["Use the variable $BITALIC x $EITALIC for the domain of a function.",
147 checkCorrect => 1,
148 score => 0]
149 )));
150
151 #---Part d)--------------------------
152 $ran1 = $f->eval(x=>$xnum[0]);
153 $ran2 = $f->eval(x=>$xnum[1]);
154 if ($ran2<$ran1) {
155 $ran2 = $ran1;
156 $ran1 = $f->eval(x=>$xnum[1]);
157 }
158 @range = ("$ran1 <= y < $ran2", "$ran1 < y <= $ran2");
159 $ans_d = Compute($range[$n]);
160 ANS($ans_d->cmp->withPostFilter(AnswerHints(
161 sub {
162 my ($correct,$student,$ans) = @_;
163 return $student =~ /x/;
164 } => ["Use the variable $BITALIC y $EITALIC for the range of a function.",
165 checkCorrect => 1,
166 score => 0]
167 )));
168
169 ######################################
170 # Solutions
171
172 Context()->texStrings;
173 SOLUTION(EV3(<<'END_SOLUTION'));
174 $PAR SOLUTION $PAR
175 $BR
176 a) \( f($input[0]) = $ans_a\)
177 $BR
178 b) \( f($input[1]) = $ans_b \)
179 $BR
180 c) The domain: \($ans_c\)
181 $BR
182 d) The range: \($ans_d\)
183 END_SOLUTION
184 Context()->normalStrings;
185
186
187 ;
188 ENDDOCUMENT();