Specialized parsers
From WeBWorK
(Difference between revisions)
m (Fixed some broken links.) 
m (Fixed incorrect link) 

(One intermediate revision by one user not shown)  
Line 5:  Line 5:  
Examples of modifications are give below.  Examples of modifications are give below.  
−  A description of advanced techniques for customizing the parser are at [[  +  A description of advanced techniques for customizing the parser are at [[Modifying Contexts (advanced)]]. 
=== Specialized Parser Macro files ===  === Specialized Parser Macro files ===  
Line 71:  Line 71:  
* [http://webwork.maa.org/pod/pg_TRUNK/macros/parserVectorUtils.pl.html parserVectorUtils.pl]  * [http://webwork.maa.org/pod/pg_TRUNK/macros/parserVectorUtils.pl.html parserVectorUtils.pl]  
** Utility macros that are useful in vector problems.  ** Utility macros that are useful in vector problems.  
−  +  
[[Category:Contexts]]  [[Category:Contexts]]  
+  [[Category:MathObjects]]  
+  [[Category:Reference Tables]] 
Latest revision as of 08:38, 26 May 2013
parserYourModsHere.pl
Modifications to the Parser change the way that student responses are interpreted. By convention files that modify the parser are named starting with "parser"  e.g. parserYourModsHere.pl
.
test
SpecializedContexts Describes another advanced method for customizing MathObjects by modifying the context.
Examples of modifications are give below.
A description of advanced techniques for customizing the parser are at Modifying Contexts (advanced).
Specialized Parser Macro files
Here is a partial list of the parser modifying files.
Use loadMacros("parserAssignment.pl");
to make the parser modifications available for a WeBWorK question.
Check the POD documentation for more examples.
 parserAssignment.pl
 checks answers of the form \(y=3x+5\) with the LHS of the equation required.
 follow the link above to see the additional statements that must be inserted in the question to use this file.
 parserAutoStrings.pl

parserAutoStrings.pl
 Force String() to accept any string as a potential answer.

AutoStrings()  all strings are accepted DefineStrings("string1", "string2") DefineStrings(qw(string1 string2))  is a quick way to define "legitimate" strings.
 parserCustomization.pl
 Placeholder for site/courselocal customization file.
 parserDifferenceQuotient.pl
 An answer checker for difference quotients.
 parserFormulaUpToConstant.pl
 implements formulas ``plus a constant.
 Students must include the ``+C as part of their answers
 parserFormulaWithUnits.pl
 Implements a formula with units.
 For example:
FormulaWithUnits("3x+1 ft")>cmp FormulaWithUnits($a*$x+1,"ft")>cmp
 parserFunction.pl
 An easy way of adding new functions to the current context.

parserFunction("f(x)" => "sqrt(x+1)2");
 parserImplicitEquation.pl
 An answer checker for implicit equations.
Context("ImplicitEquation"); $f = ImplicitEquation("x^2 = cos(y)"); $f = ImplicitEquation("x^2  2y^2 = 5",limits=>[[3,3],[2,2]]); $f = ImplicitEquation("x=1/y",tolerance=>.0001);
 parserImplicitPlane.pl
 Implement implicit planes.
$P = ImplicitPlane(Point(1,0,2),Vector(1,1,3)); # x+y+3z = 5 $P = ImplicitPlane([1,0,2],[1,1,3]); # x+y+3z = 5 $P = ImplicitPlane([1,0,2],4); # x+2z = 4 $P = ImplicitPlane("x+2yz=5");
 parserMultiAnswer.pl
 Tie several blanks to a single answer checker.
 parserNumberWithUnits.pl
 Implements a number with units.
ANS(NumberWithUnits("3 ft")>cmp); ANS(NumberWithUnits("$a*$b ft")>cmp); ANS(NumberWithUnits($a*$b,"ft")>cmp);
 parserParametricLine.pl
 Implements Formulas that represent parametric lines.
 parserPopUp.pl
 Popup menus compatible with Value objects.
 parserPrime.pl
 Defines
f'(x)
so that students and authors can use the prime notation in defining equations.  After loading file use perl command
parser::Prime>Enable;
to enable the feature.
 Defines
 parserRadioButtons.pl
 Radio buttons compatible with Value objects, specifically MultiAnswer objects.
 parserSolutionFor.pl
 An answer checker that checks if a student's answer satisifies a (possibly nonlinear) implicit equation.
 parserVectorUtils.pl
 Utility macros that are useful in vector problems.