Parent Directory
|
Revision Log
Updated example files to use new features of parser and its answer checkers.
1 ########################################################## 2 # 3 # Example showing how to use the built-in answer checker for parsed values. 4 # 5 6 DOCUMENT(); # This should be the first executable line in the problem. 7 8 loadMacros( 9 "PGbasicmacros.pl", 10 "PGanswermacros.pl", 11 "Parser.pl", 12 ); 13 14 TEXT(beginproblem()); 15 16 ########################################################## 17 # 18 # The setup 19 # 20 21 Context('Complex'); 22 23 $z = random(-5,5,1) + non_zero_random(-5,5,1)*i; 24 25 $f = Formula('z^2 + 2z - 1'); 26 $fz = $f->eval(z => $z); 27 28 ########################################################## 29 # 30 # The problem text 31 # 32 33 Context()->texStrings; 34 BEGIN_TEXT 35 36 Suppose \(f(z) = $f\).$BR 37 Then \(f($z)\) = \{ans_rule(20)\}. 38 39 END_TEXT 40 Context()->normalStrings; 41 42 ########################################################### 43 # 44 # The answer 45 # 46 47 ANS($fz->cmp); 48 49 ########################################################### 50 51 ENDDOCUMENT(); # This should be the last executable line in the problem.
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |