Difference between revisions of "AnswerBlankInExponent1"
Jump to navigation
Jump to search
Paultpearson (talk | contribs) |
Paultpearson (talk | contribs) (PGML example link) |
||
Line 6: | Line 6: | ||
</p> |
</p> |
||
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/AnswerBlankInExponent1.pg FortLewis/Authoring/Templates/Algebra/AnswerBlankInExponent1.pg] |
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/AnswerBlankInExponent1.pg FortLewis/Authoring/Templates/Algebra/AnswerBlankInExponent1.pg] |
||
+ | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/AnswerBlankInExponent1_PGML.pg FortLewis/Authoring/Templates/Algebra/AnswerBlankInExponent1_PGML.pg] |
||
<br clear="all" /> |
<br clear="all" /> |
Revision as of 11:19, 13 June 2015
Answer Blank in the Exponent
This PG code shows how to put an answer blank in the exponent.
- File location in OPL: FortLewis/Authoring/Templates/Algebra/AnswerBlankInExponent1.pg
- PGML location in OPL: FortLewis/Authoring/Templates/Algebra/AnswerBlankInExponent1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "PGcourse.pl", "unionTables.pl", ); TEXT(beginproblem()); |
Initialization: |
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; |
Setup: We have a some code to display the answer blanks nicely in different modes, which you shouldn't need to change except perhaps the width for each answer blank. |
Context()->texStrings; BEGIN_TEXT Rewrite the following using a single exponent. $BR $BR $showpower END_TEXT Context()->normalStrings; |
Main Text:
We insert the nicely formatted answer blanks using |
$showPartialCorrectAnswers = 1; ANS( $base->cmp() ); ANS( $exponent->cmp() ); |
Answer Evaluation: |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:${PAR} Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |