Restricting answers that should reduce to a constant.
Download file: RestrictingFunctions.pg
DOCUMENT(); loadMacros('PGstandard.pl', 'PGML.pl', 'PGcourse.pl');
Preamble
These standard macros need to be loaded.$expr = Formula("sin(x)^2 + cos(x)^2"); $deriv = Compute(0)->cmp(showTypeWarnings => 0);
Setup
Here we’ve turned off type warnings in the answer checking, so that a student entering an un-simplified answer (e.g., 2 sin(x) cos(x) + 2 cos(x) (-sin(x))
) will have it marked wrong (but not get feedback that says “you should have entered a number”).
BEGIN_PGML Find and completely simplify: [``\frac{d}{dx}\bigl(\sin^2 x + \cos^2 x\bigr) = ``] [__]{$deriv} END_PGML
Statement
This is the problem statement in PGML.BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT();
Solution
A solution should be provided here.