########################################################## # # 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('Vector'); $P1 = Point(1,random(-3,3,1),random(-3,3,1)); $P2 = Point(random(-3,3,1),4,random(-3,3,1)); $V = Vector($P2-$P1); Context()->flags->set(ijk=>0); Context()->constants->add(a=>1,b=>1,c=>1); $ABC = Formula(""); ########################################################## # # The problem text # Context()->texStrings; BEGIN_TEXT The vector from \($P1\) to \($P2\) is \{ans_rule(20)\}. $PAR You can use either \($ABC\) or \(\{$ABC->ijk\}\) notation,$BR and can perform vector operations to produce your answer. END_TEXT Context()->normalStrings; ########################################################### # # The answer # ANS($V->cmp(promotePoints=>1)); # allow answers to be points or vectors ########################################################### ENDDOCUMENT(); # This should be the last executable line in the problem.