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 for integer n 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_SOLUTION
The cosine of an angle is zero when the angle is [`(n + 1 / 2)\pi`] for any
integer [`n`].
END_PGML_SOLUTION

ENDDOCUMENT();

Solution

A solution should be provided here.