########################################################## # # Example of the non-standard precedences as a possible alternative # that makes it possible to write "sin 2x" and get "sin(2x)" # DOCUMENT(); # This should be the first executable line in the problem. loadMacros( "PGbasicmacros.pl", "PGanswermacros.pl", "Parser.pl", "parserTables.pl", ); TEXT(beginproblem()); ########################################################## # # Use standard precedences for multiplication # Context()->usePrecedence("Standard"); $standard = ParserTable( 'Formula("sin 2xy/3")', 'Formula("sin 2x y/3")', 'Formula("sin 2x y / 3")', 'Formula("sin 2x+5")', 'Formula("sin x(x+1)")', 'Formula("sin x (x+1)")', 'Formula("1/2xy")', 'Formula("1/2 xy")', 'Formula("1/2x y")', 'Formula("sin^2 x")', 'Formula("sin^(-1) x")', 'Formula("x^2x")', ); Context()->usePrecedence("Non-Standard"); $nonstandard = ParserTable( 'Formula("sin 2xy/3")', 'Formula("sin 2x y/3")', 'Formula("sin 2x y / 3")', 'Formula("sin 2x+5")', 'Formula("sin x(x+1)")', 'Formula("sin x (x+1)")', 'Formula("1/2xy")', 'Formula("1/2 xy")', 'Formula("1/2x y")', 'Formula("sin^2 x")', 'Formula("sin^(-1) x")', 'Formula("x^2x")', ); ########################################################### # # The problem text # BEGIN_TEXT $BEGIN_ONE_COLUMN In this problem, we compare the standard and non-standard precedences for multiplication. $PAR \{Title("The Non-Standard precedences:")\} $PAR $nonstandard $PAR$BR \{Title("The Standard precedences:")\} $PAR $standard $END_ONE_COLUMN END_TEXT ########################################################### ENDDOCUMENT(); # This should be the last executable line in the problem.