Difference between revisions of "FractionAnswer1"
Jump to navigation
Jump to search
Paultpearson (talk | contribs) (Add link to PGML version in OPL) |
Paultpearson (talk | contribs) m |
||
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/FractionAnswer1.pg FortLewis/Authoring/Templates/Algebra/FractionAnswer1.pg] |
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/FractionAnswer1.pg FortLewis/Authoring/Templates/Algebra/FractionAnswer1.pg] |
||
− | * File location in OPL (PGML version): [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/FractionAnswer1_PGML.pg FortLewis/Authoring/Templates/Algebra/ |
+ | * File location in OPL (PGML version): [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/FractionAnswer1_PGML.pg FortLewis/Authoring/Templates/Algebra/FractionAnswer1_PGML.pg] |
<br clear="all" /> |
<br clear="all" /> |
Revision as of 14:30, 7 June 2015
Answer is a Fraction - Try the problem in WeBWorK
This PG code shows how to write a question in which the answer must be a fraction (rational number).
- File location in OPL: FortLewis/Authoring/Templates/Algebra/FractionAnswer1.pg
- File location in OPL (PGML version): FortLewis/Authoring/Templates/Algebra/FractionAnswer1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "contextFraction.pl", "AnswerFormatHelp.pl", ); TEXT(beginproblem()); |
Initialization: |
Context("Fraction-NoDecimals"); $answer = Compute("3/2"); |
Setup:
The macro Context("Fraction"); Context("Fraction-NoDecimals"); Context("LimitedFraction"); Context("LimitedProperFraction"); For the differences among these, see the POD documentation contextFraction.pl.html |
Context()->texStrings; BEGIN_TEXT Simplify \( \displaystyle \frac{6}{4} \). $BR $BR Answer = \{ ans_rule(20) \} \{ AnswerFormatHelp("fractions") \} END_TEXT Context()->normalStrings; |
Main Text: |
$showPartialCorrectAnswers = 1; ANS( $answer->cmp( studentsMustReduceFractions=>1, reduceFractions=>1, allowMixedNumbers=>0, ) ); |
Answer Evaluation: There are many context flags that control how fraction answers are checked. See the POD documentation contextFraction.pl.html |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:${PAR} Factor and cancel to obtain \( \displaystyle $answer \) END_SOLUTION Context()->normalStrings; ENDDOCUMENT(); |
Solution: |