First, my apologies for not reading the full thread here. I hope what I am posting is relevant.
If you have problems that want basic algebra expressions in "simplified", "factored", "expanded" form, etc., try using contextFrom.pl (which is in the OPL, in the PCC macros folder). For example, here is a minimal problem file. Then two screenshots with MathQuill in use. One with correct answers accepted, and one showing what happens if the form is not right. The context is flexible in certain senses, like (x+1)(x+2) is counted equivalent to (2+x)(x+1), etc. But it catches the things that math teachers are trying to catch.
If this works for you, it /might/ be as easy as visiting each problem, loading contextForm.pl, and activating Context("Form") immediately prior to the declaration of the answer formula.
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGML.pl",
"contextForm.pl",
"PGcourse.pl",
);
##############################################
Context("Form");
$display = Formula("(3x+9)/(x^2-9)");
$answer = Formula("3/(x-3)");
$display2 = Formula("x^2+3x+2");
$answer2 = Formula("(x+2)(x+1)");
##############################################
TEXT(beginproblem());
BEGIN_PGML
a. Simplify [` [$display] `].
[_]{$answer}{20}
a. Factor [` [$display2] `].
[_]{$answer2}{20}
END_PGML
##############################################
ENDDOCUMENT();
