## DESCRIPTION
## Algebra: answer blank in the exponent
## ENDDESCRIPTION

## KEYWORDS('algebra', 'answer blank in the exponent')

## DBsubject('WeBWorK')
## DBchapter('WeBWorK Tutorial')
## DBsection('Fort Lewis Tutorial 2011')
## Date('01/30/2011')
## Author('Paul Pearson')
## Institution('Fort Lewis College')
## TitleText1('')
## EditionText1('')
## AuthorText1('')
## Section1('')
## Problem1('')


###########################
#  Initialization

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGcourse.pl",
"unionTables.pl",
);

TEXT(beginproblem());


###########################
#  Setup

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

$n = random(3,9,1);

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

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

#
#  Display exponents nicely
#
$w1 = 10; # width of 1st answer blank
$w2 = 10; # width of 2nd answer blank
Context()->texStrings;
if ($displayMode eq 'TeX') {
  $showpower =
  "\( \displaystyle $expression = (" . ans_rule($w1) . ")^{" . ans_rule($w2) . "}\)";
} else {
  $showpower =
  ColumnTable(
  "\( \displaystyle $expression = \Big( \) " . ans_rule($w1) . " \( \Big) \)",
  ans_rule($w2).$BR.$BR,
  indent => 0, separation => 0, valign => "BOTTOM"
  );
}
Context()->normalStrings;


###########################
#  Main text

Context()->texStrings;
BEGIN_TEXT
Rewrite the following using a single exponent.
$BR
$BR
$showpower
END_TEXT
Context()->normalStrings;


############################
#  Answer evaluation

$showPartialCorrectAnswers = 1;

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


############################
#  Solution

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;

COMMENT('MathObject version.');

ENDDOCUMENT();