Periodic Answers

Periodic answers

Complete Code

Download file: PeriodicAnswers.pg

PG problem file

Explanation

DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'PGcourse.pl');

Preamble

These standard macros need to be loaded.
$answer = Real('pi / 2')->with(period => pi);

Setup

This allows any answer of the form pi / 2 + n pi where n is a particular integer to be accepted.

BEGIN_PGML
Enter a solution to [`\cos(\theta) = 0`].

[`\theta =`] [_]{$answer}{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 [`\frac{2n + 1}{2}\pi`] for
any integer [`n`].
END_PGML_HINT

Hint

A hint is provided.

BEGIN_PGML_SOLUTION
Solution explanation goes here.
END_PGML_SOLUTION

ENDDOCUMENT();

Solution

A solution should be provided here.