########################################################## # # Example showing how to use the built-in answer checker for parsed values. # DOCUMENT(); # This should be the first executable line in the problem. loadMacros( "PGbasicmacros.pl", "PGanswermacros.pl", "Parser.pl", ); TEXT(beginproblem()); ########################################################## # # The setup # Context('Interval'); $p1 = random(-5,2,1); $p2 = random($p1+1,$p1+7,1); $f = Formula("x^2 - ($p1+$p2) x + $p1*$p2")->reduce; $I = Interval("($p1,$p2)"); ########################################################## # # The problem text # Context()->texStrings; BEGIN_TEXT The function \(f(x) = $f\) is negative for values of \(x\) in the interval \{ans_rule(20)\}. END_TEXT Context()->normalStrings; ########################################################### # # The answer # ANS($I->cmp); ########################################################### ENDDOCUMENT(); # This should be the last executable line in the problem.