I would like 2 sqrt(12) to be automatically simplified to 4 sqrt(3) in the solution section of this problem, even though the students may enter their answer in any form. The current code forces the answer to be 2 sqrt(12) to avoid a decimal answer.

In fact, in other similar problems, I would also like to be able to have the option to force the students to enter their answer as a simplified square root.

Any suggestions will be greatly appreciated.

Thanks

DOCUMENT();

loadMacros("PGstandard.pl",

"MathObjects.pl",

"PGML.pl",

"AnswerFormatHelp.pl",

"PGcourse.pl");

TEXT(beginproblem());

$a1=random(12,12,1);

$ans2=Compute(2*sqrt($a1));

BEGIN_PGML

Find the following limit.

[``\lim_{x\rightarrow [$a1]} \frac{\sqrt{x}-\sqrt{[$a1]}}{x-[$a1]}=``][_______]{$ans2}

END_PGML

BEGIN_PGML_SOLUTION

*SOLUTION*

[``\lim_{x\rightarrow [$a1]} \frac{\sqrt{x}-\sqrt{[$a1]}}{x-[$a1]}=2\sqrt{[$a1]}``]

END_PGML_SOLUTION

ENDDOCUMENT();