########################################################### # # Example showing how to use the Parser's function # answer checker. # 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')->variables->add(a=>'Real'); $x = Formula('x'); $a = Formula('a'); $f = log($x-$a); $I = Formula("(-infinity,a]"); ########################################################### # # The problem text # Context()->texStrings; BEGIN_TEXT Suppose \(f(x) = $f\). $PAR Then \(f\) is undefined for \(x\) in the interval(s) \{ans_rule(20)\}. $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}.$BR Enter ${LQ}${BTT}NONE${ETT}${RQ} if the function is always defined. ${ESMALL} ${ECENTER} END_TEXT Context()->normalStrings; ########################################################### # # The answers # ANS(List($I)->cmp( list_type => 'a list of intervals', # override these names to avoid entry_type => "an interval", # 'formula returning ...' messages )); Context()->variables->remove('x'); # error if 'x' is used in answer $showPartialCorrectAnswers = 1; ########################################################### ENDDOCUMENT(); # This should be the last executable line in the problem.