Difference between revisions of "FormulaAnswer1"
Jump to navigation
Jump to search
Paultpearson (talk | contribs) |
Paultpearson (talk | contribs) (Add link to PGML version in OPL) |
||
Line 6: | Line 6: | ||
</p> |
</p> |
||
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/FormulaAnswer1.pg FortLewis/Authoring/Templates/Misc/FormulaAnswer1.pg] |
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/FormulaAnswer1.pg FortLewis/Authoring/Templates/Misc/FormulaAnswer1.pg] |
||
+ | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/FormulaAnswer1_PGML.pg FortLewis/Authoring/Templates/Misc/FormulaAnswer1_PGML.pg] |
||
<br clear="all" /> |
<br clear="all" /> |
Revision as of 20:12, 7 June 2015
Answer is a Number or a Formula - Try it out
This PG code shows how to write a question whose answer is a number or a formula.
- File location in OPL: FortLewis/Authoring/Templates/Misc/FormulaAnswer1.pg
- PGML location in OPL: FortLewis/Authoring/Templates/Misc/FormulaAnswer1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "AnswerFormatHelp.pl", ); TEXT(beginproblem()); |
Initialization: |
Context("Numeric"); $a = non_zero_random(-9,9,1); do { $b = random(2,9,1); } until ( $b != $a ); $answer1 = Compute("$a"); $answer2 = Compute("$a x^($b) + $b")->reduce(); |
Setup:
We use |
Context()->texStrings; BEGIN_TEXT Enter \( $answer1 \): \{ ans_rule(20) \} \{ AnswerFormatHelp("numbers") \} $BR $BR Enter \( $answer2 \): \{ ans_rule(20) \} \{ AnswerFormatHelp("formulas") \} END_TEXT Context()->normalStrings; |
Main Text: |
$showPartialCorrectAnswers = 1; ANS( $answer1->cmp() ); ANS( $answer2->cmp() ); |
Answer Evaluation: |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:${PAR} Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |