This will be for Alex, most likely. I am trying to debug a WeBWorK problem in APEX. It uses some Perl code that is more sophisticated than I'm able to parse.
There are two issues: one is bad, and one I'm actually OK with.
1. Some students are getting a division by zero error when checking their answer. In particular, one student reported an error message of "Can’t evaluate formula on test point (-0.629604933007655,0)."
There is code to specify the test points, but I don't understand it.
2. The code suggests that there should be a WeBWorK "essay answer" box for all of the problems in this set, for students to show their work. It isn't showing up. I'm actually happy about this, because I absolutely do not have time to check the work of 200 students on 6 different implicit differentiation problems!
There are some other places where these boxes do show up, so I'm curious why it's missing here. (Maybe I will discover a way to make them go away globally.)
Here is the code:
<exercise label="ex-deriv-implicit-compute-8">
<webwork xml:id="webwork-ex-deriv-implicit-compute-8">
<pg-code>
Context("Fraction");
parser::Root->Enable;
Context()->variables->add(y=>'Real');
#($a,$b) = (2..5)[NchooseK(4,2)];
#$c = random(1,9,1);
#($m,$n,$p) = (2..5)[NchooseK(4,3)];
#if($envir{problemSeed}==1){$a=3;$b=2;$c=2;$m=2;$n=3;$p=4;};
$a=3;$b=2;$c=2;$m=2;$n=3;$p=4;
$w = ($c**(1/$p)/$a)**(1/$m);
$left = Formula("($a x^$m + $b y^$n)^$p");
$right = Formula("$c");
$frac = Fraction(-$a*$m,$b*$n);
$dydx=Formula("$frac x^($m-1) / y^($n-1)")->reduce;
@x=(random(-$w,$w,0.01),random(-$w,$w,0.01),random(-$w,$w,0.01),random(-$w,$w,0.01),random(-$w,$w,0.01));
if ($n % 2 == 1) {
@y=map{root($n,(root($p,$c) - $a*($_)**$m)/$b)}(@x);
} else {
@y=map{root($n,random(-1,1,2)*(root($p,$c) - $a*($_)**$m)/$b)}(@x);
}
@xy=map{[$x[$_],$y[$_]]}(0..4);
$dydx->{test_points}=~~@xy;
$showwork = '[@ explanation_box(message => "Show your work using implicit differentiation.") @]*';
</pg-code>
<statement>
<p>
<m><var name="$left"/>=<var name="$right"/></m>
</p>
<p>
<var name="$dydx" width="80"/>
</p>
<p>
<var name="$showwork" data="pgml"/>
</p>
</statement>
</webwork>
</exercise>