########################################################### # # 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", "Differentiation.pl", ); TEXT(beginproblem()); ########################################################### # # The setup # Context('Numeric')->variables->add(y=>'Real'); $x = Formula('x'); # used to construct formulas below. $y = Formula('y'); # # Define a function and its derivative and make them pretty # $a = random(1,8,1); $b = random(-8,8,1); $c = random(-8,8,1); $f = ($a*$x**2 + $b*$x*$y + $c*$y**2) -> reduce; $fx = $f->D('x'); $fy = $f->D('y'); ########################################################### # # The problem text # Context()->texStrings; BEGIN_TEXT Suppose \(f(x,y) = $f\). $PAR Then \(f_x(x,y) =\) \{ans_rule(30)\},$BR and \(f_y(x,y) =\) \{ans_rule(30)\}. END_TEXT Context()->normalStrings; ########################################################### # # The answers # ANS($fx->cmp); ANS($fy->cmp); $showPartialCorrectAnswers = 1; ########################################################### ENDDOCUMENT(); # This should be the last executable line in the problem.