Say that I want to ask the students to integrate 2*sin(x)*cos(x), and I want them to be allowed to write any of the following answers (forgetting the +C for now): (sin(x))^2 , -(cos(x))^2 , -1/2 cos(2x).
Is there a way to do that? For now, here is my simple code with answer (sin(x))^2:
DOCUMENT();
loadMacros(
"PGstandard.pl",
"PGML.pl",
"PGcourse.pl"
);
TEXT(beginproblem());
$f = Formula("2*sin(x)*cos(x)");
$F = Formula("(sin(x))**2");
$ans = $F;
BEGIN_PGML
[`` \int [$f] \, dx = ``] [_______________________]{$ans} [` +C `]
END_PGML
ENDDOCUMENT;
I tried creating another answer
$G = -Formula("(cos(x))**2");
and writing the answer with an 'or' in it as
$ans = ($F||$G);
but it did not work.
Any help would be appreciated. Thank you!