########################################################### # # 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", ); TEXT(beginproblem()); ########################################################### # # The setup # Context('Numeric')->variables->are( x=>'Real',y=>'Real', s=>'Real',t=>'Real' ); $x = Formula('x'); $y = Formula('y'); $a = random(1,5,1); $b = random(-5,5,1); $c = random(-5,5,1); $f = ($a*$x**2 + $b*$x*$y + $c*$y**2) -> reduce; $x = random(-5,5,1); $y = random(-5,5,1); ########################################################### # # The problem text # Context()->texStrings; BEGIN_TEXT Suppose \(f(x) = $f\). $PAR Then \(f($x,$y)\) = \{ans_rule(20)\},$BR and \(f(s+t,s-t)\) = \{ans_rule(30)\}. END_TEXT Context()->normalStrings; ########################################################### # # The answers # ANS($f->eval(x=>$x,y=>$y)->cmp); ANS($f->substitute(x=>'s+t',y=>'s-t')->cmp); $showPartialCorrectAnswers = 1; ########################################################### ENDDOCUMENT(); # This should be the last executable line in the problem.