Formula Answer

Formula answer template

Complete Code

Download file: FormulaAnswer.pg

PG problem file

Explanation

DOCUMENT();

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

Preamble

These standard macros need to be loaded.
$a = non_zero_random(-9, 9);
do { $b = random(2, 9) } until ($b != $a);

$answer1 = Compute("$a");
$answer2 = Compute("($a x^($b) + $b)/x")->reduce();

Setup

Use do { $b = random(2, 9) } until ( $b != $a ); to generate distinct random numbers.

BEGIN_PGML
Enter [`[$answer1]`]: [____]{$answer1}

Enter [``[$answer2]``]: [____]{$answer2}
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.