Parent Directory
|
Revision Log
A number of small updates and corrections. Corrected typos in the documentation, fixed a few items in the samples, added the macros needed by the samples.
1 ########################################################## 2 # 3 # Example showing how to switch different contexts 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 "parserTables.pl", 13 ); 14 15 TEXT(beginproblem()); 16 17 BEGIN_TEXT 18 In this problem, we compare formulas in complex and vector contexts. 19 Note the difference between how ${BTT}i${ETT} is treated in the two contexts. 20 $PAR 21 END_TEXT 22 23 ########################################################## 24 # 25 # Use Complex context 26 # 27 28 Context('Complex'); 29 30 BEGIN_TEXT 31 \{Title("The Complex context:")\} 32 $PAR 33 \{ParserTable( 34 'i', 35 'Formula("1+3i")', 36 'Formula("x+3i")', 37 '1 + 3*i', 38 '$x + 3*i', 39 '$z = tan(2*i)', 40 'Formula("sinh(z)")', 41 'Formula("3i+4j-k")', 42 'Formula("3i+4j-k")->eval', 43 '3*i + 4*j - k', 44 )\} 45 $PAR$BR 46 END_TEXT 47 48 49 ########################################################## 50 # 51 # Use Vector context 52 # 53 54 Context('Vector'); 55 56 BEGIN_TEXT 57 \{Title("The Vector context:")\} 58 $PAR 59 \{ParserTable( 60 'i', 61 'Formula("1+3i")', 62 'Formula("x+3i")', 63 '1 + 3*i', 64 '$x + 3*i', 65 '$z = tan(2*i)', 66 'Formula("sinh(z)")', 67 'Formula("3i+4j-k")', 68 'Formula("3i+4j-k")->eval', 69 '3*i + 4*j - k', 70 )\} 71 END_TEXT 72 73 ########################################################### 74 75 ENDDOCUMENT(); # This should be the last executable line in the problem.
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |