Difference between revisions of "InequalityEvaluators"
m |
m |
||
Line 60: | Line 60: | ||
<p> |
<p> |
||
<b>Setup:</b> |
<b>Setup:</b> |
||
− | Using <code>Context("Inequalities")</code>, if the student enters either the inequality <code>-16 <= y <= 9</code> or the interval <code>[-16,9]</code> their answer will be marked correct. |
+ | Using <code>Context("Inequalities")</code>, if the student enters either the inequality <code>-16 <= y <= 9</code> or the interval <code>[-16,9]</code> their answer will be marked correct. To mark only the inequality correct but not the interval, use <code>Context("Inequalities-Only");</code> instead. |
− | <code>Context()->variables->are(y=>"Real");</code> which would remove the default variable x from the context). To mark only the inequality correct but not the interval, use <code>Context("Inequalities-Only");</code> instead. |
||
Uncommenting the lines containing <code>EmptySet</code> creates an empty set as a named constant and uses that name. |
Uncommenting the lines containing <code>EmptySet</code> creates an empty set as a named constant and uses that name. |
||
+ | </p> |
||
+ | <p> |
||
+ | As of January 2010, the inequality is not variable-specific, so the answer <code>-16 <= x <= 9</code> would also be marked correct (we could have required students to use the variable y by using |
||
+ | <code>Context()->variables->are(y=>"Real");</code> which would remove the default variable x from the context). |
||
</p> |
</p> |
||
<p> |
<p> |
Revision as of 14:32, 22 January 2010
Inequalities as Answers
This is the essential code for having inequalities as student answers.
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "contextInequalities.pl", "PGcourse.pl", ); TEXT(beginproblem()); |
Initialization:
Include the macro file |
Context("Inequalities"); Context()->variables->add(y=>"Real"); # Context()->constants->add(EmptySet => Set()); # Context()->flags->set(noneWord=>"EmptySet"); # f(x) = x^2 - 16 on -1 <= x <= 5 $range = Compute("-16 <= y <= 9"); |
Setup:
Using
As of January 2010, the inequality is not variable-specific, so the answer For a list of all available options for the interval context, see the POD documentation at http://webwork.maa.org/doc/cvs/pg_CURRENT/macros/contextInequalities.pl |
BEGIN_TEXT What is the range of \( y = f(x) = x^2 - 16 \) on the domain \( -1 \leq x \leq 5 \)? Enter your answer using inequalities or intervals. $BR $BR Range: \{ ans_rule(20) \} END_TEXT |
Main Text: The problem text section of the file is as we'd expect. |
ANS( $range->cmp() ); ENDDOCUMENT(); |
Answer Evaluation: As is the answer. |