Disable functions and require exact fractions as answers.
Download file: DisableFunctionsTrig.pg
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'contextFraction.pl', 'PGcourse.pl');
Preamble
The contextFraction.pl
is loaded for the Fraction-NoDecimals context.
Context('Fraction-NoDecimals');
$f1 = Formula('cos(pi)');
$f2 = Formula('sin(pi / 3)');
Context()->functions->disable('All');
Context()->functions->enable('sqrt');
$answer1 = Compute('-1');
$answer2 = Compute('sqrt(3) / 2');
Setup
Select the Fraction-NoDecimals context which requires
fractions as answers and does not allow decimals.
After constructing the formulas involving trig functions, disable all
functions and re-enable the sqrt function. This means
fractions and square roots can be entered, but an error message will be
shown if any other function is entered.
BEGIN_PGML
Enter your answers as simplified fractions.
+ [`[$f1] =`] [_]{$answer1}{15}
+ [`[$f2] =`] [_]{$answer2}{15}
END_PGML
Statement
This is the problem statement in PGML.BEGIN_PGML_HINT The cosine of an angle is zero when the angle is an integer multiple of [`\pi`]. END_PGML_HINT
Hint
A hint is provided.
BEGIN_PGML_SOLUTION Provide a solution here. END_PGML_SOLUTION ENDDOCUMENT();
Solution
A solution should be provided here.