DOCUMENT();

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

Context()->variables->are(a => 'Real', b => 'Real');

$n = random(3, 9);

# TeX
$expression = "a^{$n} b^{$n}";

# MathObjects
$base     = Formula("a*b");
$exponent = Formula("$n");

# Display exponents nicely
if ($displayMode eq 'TeX') {
    $exp =
        "\( \displaystyle $expression = ("
        . ans_rule(4) . ")^{"
        . ans_rule(4) . "}\)";
} else {
    $exp =
        "<span>\(\displaystyle $expression = \Big(\)"
        . ans_rule(4)
        . '\(\Big)\)</span><span style="vertical-align: 12pt;">'
        . ans_rule(4)
        . '</span>';
}

BEGIN_PGML
Rewrite the following using a single exponent.

[$exp]*
END_PGML

ANS($base->cmp);
ANS($exponent->cmp);

BEGIN_PGML_SOLUTION
Solution explanation goes here.
END_PGML_SOLUTION

ENDDOCUMENT();