WeBWorK Problems

can't generate enough test points

can't generate enough test points

by Bruce Yoshiwara -
Number of replies: 2
I have an exercise in which students are supposed to give an expression in two variables using rational exponents. When I specified the answer in the form (x^a y^b)^(1/c), WeBWorK marked wrong a student who input an answer in the form x^(a/c) y^(b/c).

So I changed the form of the answer to x^(a/c) y^(b/c), and although WeBWorK seemed to accept answers in either form, one student got a message that WeBWorK could not generate enough valid points for comparison.

I think the relevant code is this:

Context()->variables->add(y=>'Real');
do {
$a2 = random(1, 5, 1);
$b2 = random(1, 5, 1);
$index = random(max($a2,$b2)+1, 10, 1);
} while (gcd($a2, $index) != 1);
$base = random(max($a2,$b2)+1, 10, 1);
#$ans_b = Formula("x^{$a2/$index} y^{$b2/$index}");
$ans_b = Formula("(x^{$a2} y^{$b2})^(1/$index)");
$BBOLD b. $EBOLD \(\displaystyle \frac{$a2}{$index} \log_{$base} x +
\frac{$b2}{$index} \log_{$base} y = \log_{$base}( \)

\{ans_rule(15)\} \( )\)
$PAR
ANS( $ans_b -> cmp );

Suggestions so that either form of the answer is accepted?

Thanks in advance.
Bruce
In reply to Bruce Yoshiwara

Re: can't generate enough test points

by Davide Cervone -
With non-integral powers, the base can't be negative, so your student is probably only getting test points where the x or y are negative. That can happen, even with randomly chosen points. The default limits (for MathObjects Formulas) is [-2,2], so you want to restrict that to a positive range. You probably also want to avoid 0, so something like
    ANS($ans_b->cmp(limits=>[.1,1]);
should work for you. (I didn't test it, as I don't have the seed value that was giving you problems.)

Hope that helps.

Davide