I looked over the Adaptive Parameters and also the LimitedPowers that Paul suggested, but neither looked appropriate for this case to me. The LimitedPowers seems redundant to the "contextLimitedFactor.pl" that I already use, and it would make impossible some of the more interesting problems (with higher powers) that I think are most helpful. I just successfully adapted (using bizarroArithmetic.pl) several perfect square trinomial factoring problems to require the factored form to be written as (x + 5)^2, for example, rather than (x+5)(x+5), which I would not consider in simplest form. I want my online problems to really get students' attention and help them to write the answers (and work when possible) in the best possible ways.
Back to this problem, if the equation factors to 2x(x-5)(x+3) = 0, I really only want to accept "x" or "2x" for the first factor. I really don't want to see them enter "5x" and get credit, for example, so the Adaptive Parameters seems out of place for this problem, although I will keep it in mind for my Differential Equations problems next semester!
I'd also like to see the students actually factoring the polynomial given to them in the correct form in the first place. That would eliminate things like (2x-10) for sure, because it is not fully factored. The contextLimitedFactor does not allow it to be left this way, thankfully. Unfortunately it does indeed allow -2x(5 - x). I think it is not in the best form since it contradicts the rule to not have a leading negative on a polynomial when factoring. Perhaps I am more restrictive than some, but our textbook does teach this rule. We talk about always writing our polynomial factors in descending order too, which helps achieve this goal.
But I am leaning toward needing to consider this option since it is marked as correct in factored form, but this seems to complicate the problem more than I would like. Ideally this would mean knowing what all three answers are and making sure they match the factored form above somehow. Perhaps I will just allow "-2x" and "5 - x" as correct, regardless of what else was entered. The negative 1 could be divided out of the equation anyway, so it would be justifiable to allow 5 - x as a factor. I don't think I would want to accept -x - 3 though, so I won't worry about that one. =)
I will see how the students handle it, I guess, and continue to explore the options.
I got the problem to work allowing me to check for one of two possible correct answers with the following code:
BEGIN_PGML
Now use the *Zero-Product Property* to complete the following three equations, which each give us a solution to the equation.
[________] [`= 0`], or [________] [`= 0`], or [________] [`= 0`]
END_PGML
$ans1 = Formula("x");
$ans2 = Formula("x + $c");
$ans3 = Formula("x - $b");
$c2 = Formula("$a x");
UNORDERED_ANS(
$ans1->cmp( checker => sub {
my ( $correct, $student, $self ) = @_;
return ($correct == $student || $c2 == $student);
}),
$ans2->cmp(),
$ans3->cmp()
);
Thanks to you both!
Paul