Difference between revisions of "FractionAnswer1"

From WeBWorK_wiki
Jump to navigation Jump to search
(switch to PGML and remove answerFormatHelp.pl macro)
(add historical tag and give links to newer problems.)
 
Line 1: Line 1:
  +
{{historical}}
  +
  +
<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>
 
<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>
   

Latest revision as of 05:37, 18 July 2023

This article has been retained as a historical document. It is not up-to-date and the formatting may be lacking. Use the information herein with caution.

This problem has been replaced with a newer version of this problem


Answer is a Fraction - Try the problem in WeBWorK

Click to enlarge

This PG code shows how to write a question in which the answer must be a fraction (rational number).


Templates by Subject Area

PG problem file Explanation

Problem tagging data

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 contextFraction.pl provides four contexts:

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:

Templates by Subject Area