|
From: Sam H. v. a. <we...@ma...> - 2007-10-03 20:36:33
|
Log Message:
-----------
fixed some POD errors, indentation
Modified Files:
--------------
pg/macros:
answerComposition.pl
answerCustom.pl
answerHints.pl
parserFormulaWithUnits.pl
parserFunction.pl
parserParametricLine.pl
Revision Data
-------------
Index: parserFormulaWithUnits.pl
===================================================================
RCS file: /webwork/cvs/system/pg/macros/parserFormulaWithUnits.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -Lmacros/parserFormulaWithUnits.pl -Lmacros/parserFormulaWithUnits.pl -u -r1.8 -r1.9
--- macros/parserFormulaWithUnits.pl
+++ macros/parserFormulaWithUnits.pl
@@ -14,11 +14,11 @@
Usage examples:
- ANS(FormulaWithUnits("3x+1 ft")->cmp);
- ANS(FormulaWithUnits("$a*x+1 ft")->cmp);
-
- $x = Formula("x");
- ANS(FormulaWithUnits($a*$x+1,"ft")->cmp);
+ ANS(FormulaWithUnits("3x+1 ft")->cmp);
+ ANS(FormulaWithUnits("$a*x+1 ft")->cmp);
+
+ $x = Formula("x");
+ ANS(FormulaWithUnits($a*$x+1,"ft")->cmp);
=cut
Index: parserParametricLine.pl
===================================================================
RCS file: /webwork/cvs/system/pg/macros/parserParametricLine.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -Lmacros/parserParametricLine.pl -Lmacros/parserParametricLine.pl -u -r1.13 -r1.14
--- macros/parserParametricLine.pl
+++ macros/parserParametricLine.pl
@@ -90,7 +90,7 @@
return bless $line, $class;
}
-=head3 $lhs == $rhs
+=head2 $lhs == $rhs
#
# Two parametric lines are equal if they have
Index: answerComposition.pl
===================================================================
RCS file: /webwork/cvs/system/pg/macros/answerComposition.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -Lmacros/answerComposition.pl -Lmacros/answerComposition.pl -u -r1.5 -r1.6
--- macros/answerComposition.pl
+++ macros/answerComposition.pl
@@ -18,7 +18,7 @@
=head2 COMPOSITION_ANS
- COMPOSITION_ANS($f, $g, %options)
+ COMPOSITION_ANS($f, $g, %options)
An answer checked to see if $f composed with $g matches a given function,where
$f and $g are one possible decomposition of the target function, and options are
@@ -34,11 +34,11 @@
Example:
- BEGIN_TEXT
- \(f\circ g = (1+x)^2\) when
- \(f(x)\) = \{ans_rule(20)\} and \(g(x)\) = \{ans_rule(20)\}
- END_TEXT
- COMPOSITION_ANS("x^2","1+x");
+ BEGIN_TEXT
+ \(f\circ g = (1+x)^2\) when
+ \(f(x)\) = \{ans_rule(20)\} and \(g(x)\) = \{ans_rule(20)\}
+ END_TEXT
+ COMPOSITION_ANS("x^2","1+x");
=cut
Index: answerHints.pl
===================================================================
RCS file: /webwork/cvs/system/pg/macros/answerHints.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lmacros/answerHints.pl -Lmacros/answerHints.pl -u -r1.3 -r1.4
--- macros/answerHints.pl
+++ macros/answerHints.pl
@@ -2,76 +2,89 @@
=head1 AnswerHints()
- # This is an answer-checker post-filter that allows you to produce
- # additional error messages for incorrect answers. You can trigger
- # a message for a single answer, a collection of answers, or via a
- # subroutine that determines the condition for the message.
- #
- # Note that this filter only works for MathObjects answer checkers.
- #
- # The answer hints are given as a pair using => with the right-hand
- # side being the answer message and the left-hand side being one of
- # three possibilities: 1) the value that triggers the message,
- # 2) a reference to an array of values that trigger the message, or
- # 3) a code reference to a subtroutine that accepts tthe correct
- # answer, the student's answer, and the answer hash, and returns
- # 1 or 0 depending on whether the message should or should not be
- # displayed. (See the examples below.)
- #
- # The right-hand side can be either the message string itself, or
- # a referrence to an array where the first element is the message
- # string, and the remaining elements are name-value pairs that
- # set options for the message. These can include:
- #
- # checkCorrect => 0 or 1 1 means check for messages even
- # if the answer is correct.
- # Default: 0
- #
- # replaceMessage => 0 or 1 1 means it's OK to repalce any
- # message that is already in place
- # in the answer hash.
- # Default: 0
- #
- # checkTypes => 0 or 1 1 means only perform the test
- # if the student answer is the
- # same type as the correct one.
- # Default: 1
- #
- # score => number Specifies the score to use if
- # the message is triggered (so that
- # partial credit can be given).
- # Default: keep original score
- #
- # cmp_options => [...] provides options for the cmp routine
- # used to check if the student answer
- # matches these answers.
- # Default: []
- #
- # If more than one message matches the student's answer, the first
- # one in the list is used.
- #
- # Example:
- #
- # ANS(Vector(1,2,3)->cmp(showCoordinateHints=>0)->withPostFilter(AnswerHints(
- # Vector(0,0,0) => "The zero vector is not a valid solution",
- # "-<1,2,3>" => "Try the opposite direction",
- # "<1,2,3>" => "Well done!",
- # ["<1,1,1>","<2,2,2>","<3,3,3>"] => "Don't just guess!",
- # sub {
- # my ($correct,$student,$ans) = @_;
- # return $correct . $student == 0;
- # } => "Your answer is perpendicular to the correct one",
- # Vector(1,2,3) => [
- # "You have the right direction, but not length",
- # cmp_options => [parallel=>1],
- # ],
- # 0 => ["Careful, your answer should be a vector!", checkTypes => 0, replaceMessage => 1],
- # sub {
- # my ($correct,$student,$ans) = @_;
- # return norm($correct-$student) < .1;
- # } => ["Close! Keep trying.", score => .25],
- # )));
- #
+This is an answer-checker post-filter that allows you to produce
+additional error messages for incorrect answers. You can trigger
+a message for a single answer, a collection of answers, or via a
+subroutine that determines the condition for the message.
+
+Note that this filter only works for MathObjects answer checkers.
+
+The answer hints are given as a pair using => with the right-hand
+side being the answer message and the left-hand side being one of
+three possibilities: 1) the value that triggers the message,
+2) a reference to an array of values that trigger the message, or
+3) a code reference to a subtroutine that accepts tthe correct
+answer, the student's answer, and the answer hash, and returns
+1 or 0 depending on whether the message should or should not be
+displayed. (See the examples below.)
+
+The right-hand side can be either the message string itself, or
+a referrence to an array where the first element is the message
+string, and the remaining elements are name-value pairs that
+set options for the message. These can include:
+
+=over
+
+=item C<S<< checkCorrect => 0 or 1 >>>
+
+1 means check for messages even
+if the answer is correct.
+Default: 0
+
+=item C<S<< replaceMessage => 0 or 1 >>>
+
+1 means it's OK to repalce any
+message that is already in place
+in the answer hash.
+Default: 0
+
+=item C<S<< checkTypes => 0 or 1 >>>
+
+1 means only perform the test
+if the student answer is the
+same type as the correct one.
+Default: 1
+
+=item C<S<< score => number >>>
+
+Specifies the score to use if
+the message is triggered (so that
+partial credit can be given).
+Default: keep original score
+
+=item C<S<< cmp_options => [...] >>>
+
+provides options for the cmp routine
+used to check if the student answer
+matches these answers.
+Default: []
+
+=back
+
+If more than one message matches the student's answer, the first
+one in the list is used.
+
+Example:
+
+ ANS(Vector(1,2,3)->cmp(showCoordinateHints=>0)->withPostFilter(AnswerHints(
+ Vector(0,0,0) => "The zero vector is not a valid solution",
+ "-<1,2,3>" => "Try the opposite direction",
+ "<1,2,3>" => "Well done!",
+ ["<1,1,1>","<2,2,2>","<3,3,3>"] => "Don't just guess!",
+ sub {
+ my ($correct,$student,$ans) = @_;
+ return $correct . $student == 0;
+ } => "Your answer is perpendicular to the correct one",
+ Vector(1,2,3) => [
+ "You have the right direction, but not length",
+ cmp_options => [parallel=>1],
+ ],
+ 0 => ["Careful, your answer should be a vector!", checkTypes => 0, replaceMessage => 1],
+ sub {
+ my ($correct,$student,$ans) = @_;
+ return norm($correct-$student) < .1;
+ } => ["Close! Keep trying.", score => .25],
+ )));
=cut
Index: parserFunction.pl
===================================================================
RCS file: /webwork/cvs/system/pg/macros/parserFunction.pl,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lmacros/parserFunction.pl -Lmacros/parserFunction.pl -u -r1.9 -r1.10
--- macros/parserFunction.pl
+++ macros/parserFunction.pl
@@ -32,7 +32,7 @@
object.
=cut
-
+
loadMacros('MathObjects.pl');
sub _parserFunction_init {parserFunction::Init()}; # don't reload this file
@@ -125,7 +125,7 @@
&{$def->{function}}(@_);
}
-=head3 ($Function)->D
+=head2 ($Function)->D
#
# Compute the derivative of (single-variable) functions
Index: answerCustom.pl
===================================================================
RCS file: /webwork/cvs/system/pg/macros/answerCustom.pl,v
retrieving revision 1.14
retrieving revision 1.15
diff -Lmacros/answerCustom.pl -Lmacros/answerCustom.pl -u -r1.14 -r1.15
--- macros/answerCustom.pl
+++ macros/answerCustom.pl
@@ -13,7 +13,7 @@
=head2 custom_cmp
- ANS(custom_cmp($correct_ans, $ans_checker, %options))
+ ANS(custom_cmp($correct_ans, $ans_checker, %options))
This answer checker provides an easy method for creating an answer
checker with a custom subroutine that performs the check for
@@ -69,10 +69,10 @@
For example, the following checks if a student entered
a unit vector (any unit vector in R^3 will do):
- ANS(custom_cmp("<1,0,0>",sub {
- my ($correct,$student,$ans) = @_;
- return norm($student) == 1;
- },showCoordinateHints => 0));
+ ANS(custom_cmp("<1,0,0>",sub {
+ my ($correct,$student,$ans) = @_;
+ return norm($student) == 1;
+ },showCoordinateHints => 0));
The checker subroutine can call Value::Error(message) to generate
an error message that will be reported in the table at the top of
|