Difference between revisions of "IntervalEvaluators"
(New page: <h2>Interval Answer Checkers: PG Code Snippet</h2> <p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> <em>This code snippet shows the essential PG code to check inte...) |
|||
Line 3: | Line 3: | ||
<p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> |
<p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> |
||
<em>This code snippet shows the essential PG code to check intervals as student answers. Note that these are <b>insertions</b>, not a complete PG file. This code will have to be incorporated into the problem file on which you are working.</em> |
<em>This code snippet shows the essential PG code to check intervals as student answers. Note that these are <b>insertions</b>, not a complete PG file. This code will have to be incorporated into the problem file on which you are working.</em> |
||
+ | </p> |
||
+ | <p style="text-align:center;"> |
||
+ | [[Problem Techniques Index|IndexOfProblemTechniques]] |
||
</p> |
</p> |
||
Line 65: | Line 68: | ||
</tr> |
</tr> |
||
</table> |
</table> |
||
+ | <p style="text-align:center;"> |
||
+ | [[Problem Techniques Index|IndexOfProblemTechniques]] |
||
+ | </p> |
Revision as of 15:17, 18 January 2008
Interval Answer Checkers: PG Code Snippet
This code snippet shows the essential PG code to check intervals as student answers. Note that these are insertions, not a complete PG file. This code will have to be incorporated into the problem file on which you are working.
PG problem file | Explanation |
---|---|
Context("Interval"); # to allow open or closed intervals, uncomment # the following line. # Context()->flags->set(ignoreEndpointTypes=>1); $int = Compute("(1,3)"); |
No changes are necessary in the tagging and description and initialization sections of the question file. In the problem set-up section of the file, we set the Context to be the Interval Context. Once we're in the Interval context, we can define intervals as we'd expect: as shown here, or with limits at infinity: $int2 = Compute("(-inf,1]"); Would give the interval from negative infinity to 1, including the point at one. Note the Context flag to make endpoint checking "fuzzy." |
BEGIN_TEXT On what interval is the parabola \( y = (1-x)(x-3) \) above the \(x\)-axis? $BR For \(x\) in \{ ans_rule(15) \} END_TEXT |
In the text section of the file, we ask the question as usual. |
ANS( $int->cmp() ); |
And in the answer and solution section of the file, we can check the answer using our interval MathObject. |