InequalityEvaluators
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 |
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. |