Difference between revisions of "FractionAnswer1"
Jump to navigation
Jump to search
(add historical tag and give links to newer problems.) |
|||
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | <h2>Answer is a Fraction</h2> |
||
+ | {{historical}} |
||
− | == [http://test.webwork.maa.org/webwork2/Problem_Authoring_Techniques/ Try it out] == |
||
+ | <p style="font-size: 120%;font-weight:bold">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/Algebra/FractionAnswer.html a newer version of this problem]</p> |
||
+ | |||
+ | |||
+ | |||
+ | <h2>Answer is a Fraction - [https://testcourses.webwork.maa.org/webwork2/Problem_Authoring_Techniques/T-PP-Algebra/1 <font size=-1> Try the problem in WeBWorK </font> ]</h2> |
||
[[File:FractionAnswer1.png|300px|thumb|right|Click to enlarge]] |
[[File:FractionAnswer1.png|300px|thumb|right|Click to enlarge]] |
||
Line 7: | Line 11: | ||
This PG code shows how to write a question in which the answer must be a fraction (rational number). |
This PG code shows how to write a question in which the answer must be a fraction (rational number). |
||
</p> |
</p> |
||
− | * Download file: [[File:FractionAnswer1.txt]] (change the file extension from txt to pg when you save it) |
||
+ | <!--* 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 NPL: <code>FortLewis/Authoring/Templates/Algebra/FractionAnswer1.pg</code> |
||
+ | * PGML location in OPL: [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" /> |
||
Line 18: | Line 22: | ||
<tr valign="top"> |
<tr valign="top"> |
||
− | <th> PG problem file </th> |
+ | <th style="width: 50%"> PG problem file </th> |
<th> Explanation </th> |
<th> Explanation </th> |
||
</tr> |
</tr> |
||
Line 44: | Line 48: | ||
DOCUMENT(); |
DOCUMENT(); |
||
− | loadMacros( |
||
+ | loadMacros('PGstandard.pl','MathObjects.pl','contextFraction.pl', |
||
− | "PGstandard.pl", |
||
+ | 'PGML.pl','PGcourse.pl'); |
||
− | "MathObjects.pl", |
||
− | "contextFraction.pl", |
||
− | "AnswerFormatHelp.pl", |
||
− | ); |
||
TEXT(beginproblem()); |
TEXT(beginproblem()); |
||
Line 67: | Line 67: | ||
<td style="background-color:#ffffdd;border:black 1px dashed;"> |
<td style="background-color:#ffffdd;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
− | Context( |
+ | Context('Fraction-NoDecimals'); |
− | $answer = Compute( |
+ | $answer = Compute('3/2'); |
</pre> |
</pre> |
||
</td> |
</td> |
||
Line 82: | Line 82: | ||
Context("LimitedProperFraction"); |
Context("LimitedProperFraction"); |
||
</pre> |
</pre> |
||
− | For the differences among these, see the POD documentation [http://webwork.maa.org/pod/ |
+ | For the differences among these, see the POD documentation [http://webwork.maa.org/pod/pg/macros/contextFraction.html contextFraction.pl] |
</p> |
</p> |
||
</td> |
</td> |
||
Line 92: | Line 92: | ||
<td style="background-color:#ffdddd;border:black 1px dashed;"> |
<td style="background-color:#ffdddd;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
− | Context()->texStrings; |
||
+ | BEGIN_PGML |
||
− | BEGIN_TEXT |
||
+ | Simplify [` \displaystyle \frac{6}{4} `]. |
||
− | Simplify \( \displaystyle \frac{6}{4} \). |
||
+ | |||
− | $BR |
||
+ | Answer = [_______________]{$answer->cmp( |
||
− | $BR |
||
+ | studentsMustReduceFractions=>1, |
||
− | Answer = |
||
+ | reduceFractions=>1, |
||
− | \{ ans_rule(20) \} |
||
+ | allowMixedNumbers=>0, |
||
− | \{ AnswerFormatHelp("fractions") \} |
||
+ | )} |
||
− | END_TEXT |
||
+ | |||
− | Context()->normalStrings; |
||
+ | [@ helpLink('fractions') @]* |
||
+ | END_PGML |
||
</pre> |
</pre> |
||
<td style="background-color:#ffcccc;padding:7px;"> |
<td style="background-color:#ffcccc;padding:7px;"> |
||
<p> |
<p> |
||
<b>Main Text:</b> |
<b>Main Text:</b> |
||
+ | There are many context flags that control how fraction answers are checked. See the POD documentation [http://webwork.maa.org/pod/pg/macros/contextFraction.html contextFraction.pl] |
||
</p> |
</p> |
||
</td> |
</td> |
||
</tr> |
</tr> |
||
− | <!-- Answer evaluation section --> |
||
− | <tr valign="top"> |
||
− | <td style="background-color:#eeddff;border:black 1px dashed;"> |
||
− | <pre> |
||
− | $showPartialCorrectAnswers = 1; |
||
− | |||
− | ANS( $answer->cmp( |
||
− | studentsMustReduceFractions=>1, |
||
− | reduceFractions=>1, |
||
− | allowMixedNumbers=>0, |
||
− | ) |
||
− | ); |
||
− | </pre> |
||
− | <td style="background-color:#eeccff;padding:7px;"> |
||
− | <p> |
||
− | <b>Answer Evaluation:</b> |
||
− | There are many context flags that control how fraction answers are checked. See the POD documentation [http://webwork.maa.org/pod/pg_TRUNK/macros/contextFraction.pl.html contextFraction.pl.html] |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 137: | Line 122: | ||
<td style="background-color:#ddddff;border:black 1px dashed;"> |
<td style="background-color:#ddddff;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
− | |||
+ | BEGIN_PGML_SOLUTION |
||
− | Context()->texStrings; |
||
+ | Solution explanation goes here. |
||
− | BEGIN_SOLUTION |
||
+ | END_PGML_SOLUTION |
||
− | ${PAR}SOLUTION:${PAR} |
||
− | Factor and cancel to obtain |
||
− | \( \displaystyle $answer \) |
||
− | END_SOLUTION |
||
− | Context()->normalStrings; |
||
ENDDOCUMENT(); |
ENDDOCUMENT(); |
Latest revision as of 04:37, 18 July 2023
This problem has been replaced with a newer version of this problem
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).
- PGML location in OPL: FortLewis/Authoring/Templates/Algebra/FractionAnswer1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros('PGstandard.pl','MathObjects.pl','contextFraction.pl', 'PGML.pl','PGcourse.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 |
BEGIN_PGML Simplify [` \displaystyle \frac{6}{4} `]. Answer = [_______________]{$answer->cmp( studentsMustReduceFractions=>1, reduceFractions=>1, allowMixedNumbers=>0, )} [@ helpLink('fractions') @]* END_PGML |
Main Text: There are many context flags that control how fraction answers are checked. See the POD documentation contextFraction.pl |
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT(); |
Solution: |