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

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

Yep, that does it. Thanks!

Bruce

Bruce