########################################################## # # 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", "parserUtils.pl", ); TEXT(beginproblem()); ########################################################## # # The setup # Context("Interval"); $a = non_zero_random(-5,5,1); $f = Formula("(x^2+1)/(x-$a)")->reduce; $R = Compute("(-inf,$a),($a,inf)"); ########################################################## # # The problem text # Context()->texStrings; BEGIN_TEXT Suppose \(\displaystyle f(x) = $f\). $PAR Then \(f\) is defined on the intervals \{ans_rule(30)\}. $PAR ${BCENTER} ${BSMALL} To enter more than one interval, separate them by commas.$BR Use ${LQ}${BTT}infinity${ETT}${RQ} for ${LQ}\(\infty\)${RQ} and ${LQ}${BTT}-infinity${ETT}${RQ} for ${LQ}\(-\infty\)${RQ}. ${ESMALL} ${ECENTER} END_TEXT Context()->normalStrings; ########################################################### # # The answer # ANS($R->cmp); $showPartialCorrectAnswers = 1; ########################################################### ENDDOCUMENT(); # This should be the last executable line in the problem.