@@ -39,7 +39,7 @@ loadMacros(
39
39
"PGstandard.pl",
40
40
"PGchoicemacros.pl",
41
41
"MathObjects.pl",
42
- "parserFormulaUpToConstant .pl",
42
+ "parserMultiAnswer .pl",
43
43
"PGcourse.pl"
44
44
);
45
45
@@ -113,6 +113,33 @@ if ( $which ) {
113
113
$chg2d = "-$a";
114
114
}
115
115
116
+ $part_b = MultiAnswer($f,$f0,$f1,$chg2)->with(
117
+ singleResult => 0,
118
+ checker => sub{
119
+ my ( $correct, $student, $self ) = @_;
120
+ my ( $f_stu, $f0_stu, $f1_stu, $chg2_stu ) = @{$student};
121
+ my @score = (0,0,0,0);
122
+ if ( ($fx == $f_stu->D('x')) and ($fy == $f_stu->D('y')) ){
123
+ $score[0]=1;
124
+ }
125
+ else{
126
+ $self -> setMessage(1,"The gradient of your function must equal \(\nabla f\)");
127
+ return @score;
128
+ }
129
+ if ( $f0_stu == $f_stu->eval(x=>0,y=>0) ){
130
+ $score[1]=1;
131
+ }
132
+ if ( $f1_stu == $f_stu->eval(x=>1,y=>pi/2) ){
133
+ $score[2]=1;
134
+ }
135
+ if ( $score[1] == 1 and $score[2] == 1 and
136
+ $chg2_stu == ($f1_stu - $f0_stu) ){
137
+ $score[3]=1;
138
+ }
139
+ return @score;
140
+ }
141
+ );
142
+
116
143
117
144
Context()->texStrings;
118
145
TEXT(beginproblem());
@@ -159,28 +186,30 @@ $PAR
159
186
${BBOLD}(b)$EBOLD
160
187
By computing values of \( f \). To do this,
161
188
$BR
162
- First find \( f(x,y) = \) \{ ans_rule(45) \}
189
+ First find \( f(x,y) = \) \{ $part_b-> ans_rule(45) \}
163
190
$BR
164
191
Thus
165
192
$BR
166
- \( f(0,0) = \) \{ ans_rule(25) \} and
167
- \( f(1,\pi/2) = \) \{ ans_rule(25) \},
193
+ \( f(0,0) = \) \{ $part_b-> ans_rule(25) \} and
194
+ \( f(1,\pi/2) = \) \{ $part_b-> ans_rule(25) \},
168
195
$BR
169
- and the change in \(f\) is \{ ans_rule(35) \}.
196
+ and the change in \(f\) is \{ $part_b-> ans_rule(35) \}.
170
197
171
198
END_TEXT
172
199
Context()->normalStrings;
173
200
201
+ #part a answers
202
+
174
203
ANS($rx->cmp() );
175
204
ANS($ry->cmp() );
176
205
ANS($integr->cmp() );
177
206
ANS($int1->cmp() );
178
207
ANS($int2->cmp() );
179
208
ANS($chg1->cmp() );
180
- ANS($f->cmp(upToConstant=>1) );
181
- ANS($f0->cmp() );
182
- ANS($f1->cmp() );
183
- ANS($chg2 ->cmp() );
209
+
210
+ #part b answers
211
+
212
+ ANS($part_b ->cmp());
184
213
185
214
Context()->texStrings;
186
215
SOLUTION(EV3(<<'END_SOLUTION'));
0 commit comments