WeBWorK Main Forum

Answer checking

Answer checking

by Adam Z -
Number of replies: 0

Hello all,

I have a hard time only allowing radical format as an answer, this code allows students to put any equivalent form (as below) which I do not want. any help is appreciatedĀ 

context("Numeric");

Context()->strings->add(none=>{},EmptySet=>{alias=>"none"});

$a = random(2,15,1);

$b = random(2,5,1);

$c = list_random(2,3,5,6,7,8,10,11,13,14,15,17);

$d = $b*$c;

($aa,$dd)= reduce($a,$d);

$ans = Compute("($aa*(sqrt($c)))/($dd)") -> reduce;


########################################################################


Context()->texStrings;

BEGIN_TEXT

Simplify

\[

\frac{$a}{$b\sqrt{$c}}.

\]

$PAR

\{ ans_rule(30) \}

END_TEXT

Context()->normalStrings;


########################################################################


ANS( $ans->cmp() );


ENDDOCUMENT();


here example