Provides an answer blank in an exponent.
Download file: AnswerInExponent.pg
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'PGcourse.pl');
Preamble
These standard macros need to be loaded.Context()->variables->are(a => 'Real', b => 'Real'); $n = random(3, 9); $ans_rule1 = ans_rule(4); $ans_rule2 = ans_rule(4);
Setup
The Context()->variables->are sets the variables
for the context.
BEGIN_PGML
Rewrite the following using a single exponent.
[@ MODES(
TeX => "\\( \\displaystyle a^{$n}b^{$n} = ( $ans_rule1)^{$ans_rule2} \\)",
HTML =>"<div><span>\\( \\displaystyle a^{$n}b^{$n} = "
. "\\Big(\\) $ans_rule1 \\(\\Big)\\)</span>"
. "<span style='vertical-align: 1.4em'> $ans_rule2 </span></div>"
)@]*
END_PGML
Statement
To create an exponential, there is different code for both the TeX
(hard copy) and HTML version. The TeX is as expected using
the standard power ^. The HTML version creates a exponent
using the vertical-align attribute.
ANS(Compute('a b')->cmp);
ANS(Real($n)->cmp);
Answer
Because ans_rule is used above, this form of answer
checking must be used.
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT();
Solution
A solution should be provided here.