Log of /trunk/pg/lib/Value/AnswerChecker.pm
Parent Directory
Revision
3754 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Nov 12 00:30:31 2005 UTC (14 years, 1 month ago) by
dpvc
File length: 56900 byte(s)
Diff to
previous 3752
Roll back Mike's change, since this can cause unwanted error messages
in list comparisons and other situations where the equality check
could compare different types of objects (for example) or where the
comparison could legitimately fail. We only want to report errors
here when the user-supplied checker code fails.
This change would cause errors to be reported, for example, when the
user (incorrectly) entered a vector one time and then a formula
(correctly) the next time. When the previous answer is checked against
the current one, this change would report an error rather than
silently ignoring the error, as it should.
Revision
3752 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Nov 12 00:12:54 2005 UTC (14 years, 1 month ago) by
gage
File length: 56938 byte(s)
Diff to
previous 3715
Changes to code checking whether the previous answer is equivalent to the current answer.
In this module additional code was answer to check for errors in the overloaded ==
in case the two Values can't be compared.
In PGanswermacros.pl the filter which handles "parse_previous_answer"
was modified to make sure the context is the same in the previous answer and the current answer.
Revision
3715 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Oct 16 03:27:35 2005 UTC (14 years, 2 months ago) by
dpvc
File length: 56900 byte(s)
Diff to
previous 3713
Added a new experimental diagonstic function for the function answer
checker. When enabled, it will produce graphs of the correct answer,
the student answer, and the absolute and relative errors, and will
list the data points used in the comparison, plus the numerical values
of the results and errors.
To enable the diagnostic, use
ANS(fun_cmp($f,diagnostics=>1));
Note that only single-variable functions can be graphed at the moment,
so if you are using a multi-variable check, you need to disable the
graphing. To do this use
ANS(fun_cmp($f,vars=>['x','y'],diagnostics=>[showGraphs=>0]));
The diagnostic mode is only available for the Parser-based versions of
the function checker, and (of course) with the native Parser objects
as well:
ANS(Formula($f)->cmp(diagnostics=>1));
There are now Context settings to control the diagnostics, which can
be set through Context()->diagnostics->set(). For example
Context()->diagnostics->set(formulas=>{showGraphs=>0});
would turn off graphs for all functions comparisons. Some of the
other values you can set are:
formulas => {
showTestPoints => 1, # show the test points and function values
showRelativeErrors => 1, # show the relative errors for the student answer
showAbsoluteErrors => 1, # show the absolute errors for the student answer
showGraphs => 1, # show the various graphs
graphRelativeErrors => 1, # show the relative error graph
graphAbsoluteErrors => 1, # show the absolute error graph
clipRelativeError => 5, # don't show relative errors above 5
clipAbsoluteError => 5, # don't show absolute errors above 5
plotTestPoints => 1, # include dots at the test points
combineGraphs => 1, # show correct and student graphs in one image
},
graphs => {
divisions => 75, # the number of data points to plot
limits => [-2,2], # the lower and upper limit of the plot
# (taken from the function limits if not provided)
size => 250, # pixel size of the image (could be [width,height])
grid => [10,10], # number of grid lines in each direction
axes => [0,0], # where to put axes relative to origin
}
Any of these can be set in the Context(), or in the answer checker
itself. If you set diagnostics to an array reference, the entries in
the array refer to element of the formulas hash. If you set
diagonstics to a hash reference, then you can set values in either the
formulas or graphs hashes, as in:
ANS(Formula($f)->cmp(diagnostics=>{
formulas => {showAbsoluteErrors=>0},
graphs => {size=>300, divisions=>100},
}));
If you want all function checkers to show diagnostics, use
Context()->diagonstics->set(formulas=>{show=>1});
The image file names are modified to include the current time so that
the names will be unique. This avoids problems with the browser cache
showing a old image when a new one has been generated. But this also
means that the temporary image directory will fill up fast, so you may
need to empty it if you use the diagnostic images frequently.
This is just a first attempt at a diagnostic feature. I think it will
help when you are not sure if the tolerances are set properly, or if
you think a student answer should be markes correct but isn't, as it
will point out which point(s) are not being accepted.
Revision
3703 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Oct 10 23:47:26 2005 UTC (14 years, 2 months ago) by
dpvc
File length: 48060 byte(s)
Diff to
previous 3696
Add a new context flag that controls how the student answer should be
displayed. The formatStudentAnswer flag can be set to 'evaluated'
(the default), which shows the final numeric answer; 'parsed', which
shows the fully parsed version (including extra parentheses for
clarity); or 'reduced', which performs constant operations, but
doesn't perform function evaluations or named-constant substitutions.
For example, if the student answers 1+2+sqrt(3), then 'evaluated' will
produce 4.73205, 'reduced' will show 3+sqrt(3), and 'parsed' will
show 1+2+sqrt(3).
Revision
3678 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Oct 1 01:13:27 2005 UTC (14 years, 2 months ago) by
dpvc
File length: 47378 byte(s)
Diff to
previous 3652
Handle the names of entries in Lists and Formulas returning lists
better. Also do better typechecking on these lists. Finally, allow
better typechecking for String objects that are being used when a
Formula answer is allowed.
Revision
3652 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Sep 24 00:47:30 2005 UTC (14 years, 2 months ago) by
dpvc
File length: 47220 byte(s)
Diff to
previous 3633
Added ability to have answers that are empty strings. String("") now
will produce a valid string object regardless of the Context's defined
string values. (You can prevent this using
Context()->flags->set(allowEmptyStrings=>0);
if you wish). String("")->cmp will produce an answer checker for an
empty string (it removes the blank checker that WW installs).
Revision
3631 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Sep 17 13:02:24 2005 UTC (14 years, 3 months ago) by
dpvc
File length: 46756 byte(s)
Diff to
previous 3630
The Parser answer checkers used to give the student answer as the
parsed but unevaluated answer. This has been changed so that the
student answer is now the computed result, no the parsed answer.
The answer preview still shows the parsed equation. This is more
consistent with the traditional answer checkers, and probably is more
valuable to the students.
Revision
3589 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Aug 30 00:44:53 2005 UTC (14 years, 3 months ago) by
dpvc
File length: 46284 byte(s)
Diff to
previous 3516
Added the ability to put class-specific answer-checker defaults into
the Context object. For example,
Context("Vector")->{cmpDefaults}{Vector}{promotePoints} = 1;
would make all Vector answer checkers include promotePoints=>1
automatically. (Note however that if a subclass of Vector is used, it
will not get this defaults, since its class name would be different.
Perhaps something more sophisticated will be needed in the future.)
Revision
3516 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 13 20:59:28 2005 UTC (14 years, 4 months ago) by
dpvc
File length: 46079 byte(s)
Diff to
previous 3511
Added isSetOfReals and canBeInUnion methods to the Value objects, and
replaced the ad hoc tests for these conditions to call these
routines.
Cleaned up the make() methods for Intervals, Sets and Unions, and
improved the new() methods to handle more cases better.
Fixed Value::makeValue() to handle an array reference correctly.
I don't THINK any of this will break anything. :-)
Revision
3511 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 13 17:50:11 2005 UTC (14 years, 4 months ago) by
dpvc
File length: 46533 byte(s)
Diff to
previous 3507
Fixed reduction warnings for individual sets, intervals and unions (in
making it work for lists, I broke it for the single items).
Revision
3504 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 13 15:57:17 2005 UTC (14 years, 4 months ago) by
dpvc
File length: 46353 byte(s)
Diff to
previous 3497
Moved the union and set reduction checks from cmp_equal to cmp_compare
so that the messages can be produced even in lists of unions.
Improved the message facilities for the list comparison so that
cmp_compare can make errors that refer to the number of the entry in
the student's answer (otherwise an extra "There was a problem with
your nth value" message needs to be prepended, which looks bad if it
can be avoided).
Use the "extra" answer checker to report syntax error messages in unordered
lists.
Revision
3497 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 13 00:25:27 2005 UTC (14 years, 4 months ago) by
dpvc
File length: 45570 byte(s)
Diff to
previous 3493
Added ability for Unions and Sets to simplify themselves
(automatically or on demand), and added flags to the Context and
answer checkers to control these features. The new Context flags
are
reduceUnions tells whether unions are automatically
reduced when they are created.
reduceUnionsForComparison tells whether unions are reduced
before comparing them for equality
or inequality (etc) if they aren't
reduced already.
reduceSets tells whether redundent elements are
removed from sets as they are created.
reduceSetsForComparison tells whether sets are reduced before
comparing them.
All of these default to true.
The Interval, Set, Union, and List answer checkers not have two new
flags for controlling these values:
studentsMustReduceUnions tells whether unions and sets will be
counted as incorrect when they are not
reduced to non-overlapping intervals
and at most one set with no repeated
entries.
showUnionReduceWarnings tells whether an error message will
be produced for non-reduced unions and
sets, or if they will be marked wrong
silently. (Not available in Lists.)
Both of these are true by default, since most professors probably want
their students to write intervals in reduced form. (Is this true?)
This corresponds the the current behavior of the interval checkers,
which require the student's answer to be the same set of intervals as
in the professor's, but with the addition of an error message when the
student answer is not reduced.
Revision
3487 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Aug 12 17:09:42 2005 UTC (14 years, 4 months ago) by
dpvc
File length: 43188 byte(s)
Diff to
previous 3469
Changed how Intervals implement the requireParenMatch flag for the
interval and union answer checker. (Use a Context flag rather than a
flag on the interval itself.) Moved the getFlag method from
Formula.pm to Value.pm so it can be used by any object class. New
feature where classes can add more context flags to set (and reset
after the answer checker runs).
Revision
3460 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Aug 10 15:07:12 2005 UTC (14 years, 4 months ago) by
dpvc
File length: 42092 byte(s)
Diff to
previous 3370
Interval (and Union) checker now accepts requireParenMatch flag for
deciding whether the interval type must match. Setting
requireParenMatch to 0 will let (1,2) match (1,2] or [1,2], etc.
Revision
3370 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jul 12 22:29:53 2005 UTC (14 years, 5 months ago) by
dpvc
File length: 41737 byte(s)
Diff to
previous 3336
A first pass at making parser error messages localizable. The
Context()->{error}{msg} hash can be used to specify translations of
the standard messages. For example,
Context()->{error}{msg}{'Division by zero'} = "Don't divide by zero, dude!";
Context()->{error}{msg}{'Function '%s' has too many inputs'} =
"You passed too many arguments to '%s'";
(I didn't translate into another language, here, but you could do
that, too.)
The msg hash could also be used within answer checkers to make certain
answer messages more appropriate for the given type of expected answer.
Revision
3298 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Jun 16 15:32:02 2005 UTC (14 years, 6 months ago) by
dpvc
File length: 41739 byte(s)
Diff to
previous 3273
New flag showAllErrors for when a custom checker is supplied. This
will cause all errors generated in the user's code to be reported
(normally, messages from the Value and Parser packages are ignored).
Revision
3273 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Jun 6 02:32:20 2005 UTC (14 years, 6 months ago) by
dpvc
File length: 41712 byte(s)
Diff to
previous 3269
Forgot to check hardcopy mode. Fixed some problems with that. The
answer array items have to turn off verbatim mode that is used when
answer are included in the hardcopy. This causes paragraph breaks
between entries in a singleResult MultiPart that includes ans_arrays,
which make the output less pretty, but at least they show up.
Revision
3269 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Jun 5 23:52:11 2005 UTC (14 years, 6 months ago) by
dpvc
File length: 41278 byte(s)
Diff to
previous 3257
Added ability to have Matrix, Vector and Point objects produce input
arrays similar to the ones available in PGmatrixmacros.pg. This
provides some substantial new functionality, and it may still have
some shaking down to do, but it should not affect the existing
functionality of the answer checkers.
To create an answer array for a matrix, vector or point, use the new
ans_array() or named_ans_array() methods of these objects. For
example:
Context("Matrix");
$M = Matrix([1,2],[3,4]);
BEGIN_TEXT
\{$M->TeX\} = \{$M->ans_array\}
END_TEXT
ANS($M->cmp);
This creates a matrix, then prints it ans creates an answer array of
the appropriate size for the matrix. The answer checker will
automatically know to handle the multiple entry blanks.
To used a named answer rule, use:
Context("Matrix");
$M = Matrix([1,2],[3,4]);
BEGIN_TEXT
\{$M->TeX\} = \{$M->named_ans_array('fred')\}
END_TEXT
NAMED_ANS(fred => $M->cmp);
Both methods also take an optional argument that specifies the width
of the answer rules. The default is 5.
You can get a multi-input point or vector array as well, and you can
make column vectors as follows:
Context("Vector");
$V = ColumnVector("1+x","3x","1-x");
BEGIN_TEXT
\{$V->TeX\} = \{$V->ans_array\}
END_TEXT
ANS($V->cmp);
Note that you can make answer arrays for matrices and vectors of
formulas as well as constants, provided the formula is an explicit
matrix or vector of formulas, and is not obtained by matrix
arithmatic.
For concistencey, all objets now have ans_rule and named_ans_rule
methods as well. The default width is 20 for these.
Revision
3257 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Jun 2 22:50:24 2005 UTC (14 years, 6 months ago) by
dpvc
File length: 26477 byte(s)
Diff to
previous 3217
Modified the Formula answer checker to allow checking of points where
the functions are undefined (i.e., attempt to check that the domains
agree). This can be enabled by setting the checkundefinedPoints flag
in the Context(), or in the formula itself. Test points where the
function is undefined will be retained and the student's answer will
have to be undefined at the same points. If the points are selected
at random, the points where the function is undefined are kept in
addition to the ones where it is defined, so the required number of
test points where the function IS defined will still need to be
found. The number of undefined points can be up to the number of
defined points. This number can be reduced by setting the
max_undefined flag. If you want to guarantee that a specific
undefined point be tested, you can provide that point using the
test_points field of the formula. For example:
Context()->flags->set(checkUndefinedPoints=>1);
$f = Formula("(x^2-1)/(x-1)");
$f->{test_points} = [[-1],[0],[1],[2]];
ANS($f->cmp);
will guarantee that the singularity at x=1 is tested, so the answer
x+1 will not be marked as correct.
If an answer matches at all the test points where the functions are
both defined, but some of the undefind points differ between the two
functions, the answer checker will generate an error message
indicating that the domains of the functions don't agree. (This is
ONLY generated with the functions match except for that.) This can be
controlled by setting the showDomainErrors flag in the formula's cmp()
call:
ANS($f->cmp(showDomainErrors=>0));
The default is to show these errors.
Revision
3217 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Apr 27 21:30:13 2005 UTC (14 years, 7 months ago) by
dpvc
File length: 26159 byte(s)
Diff to
previous 3207
Copy parameters like limits, etc, to the newly created formula when
'C0' is added by the "upToConstant=>1" option in formula cmp().
Revision
3207 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Mar 29 13:14:17 2005 UTC (14 years, 8 months ago) by
dpvc
File length: 26001 byte(s)
Diff to
previous 3206
Handle error messages in the list checker better. In particular, make
the error messages generated by custom checkers called on elements in
the list look better. Also, in an ordered list, if the student enters
extra values, call an answer checker to do a syntax check. (By
default, use the first element again, but the user can supply a
separate object to use for the checker using the extra=>object
option.)
Revision
3206 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Mar 29 03:25:29 2005 UTC (14 years, 8 months ago) by
dpvc
File length: 25644 byte(s)
Diff to
previous 3205
Compartmentalize the equality check one step further. The cmp_equal
method now calls a new cmp_compare method to perform the actual
comparison (rather than use == directly). The cmp_compare method
either calls a user-supplied checker routine, or defaults to using the
== operator. The list checker also uses cmp_compare to check the
individual items in the list. The list checker also calls a new
cmp_list_checker method to perform the list check. This can be
overridden by a user-supplied list-checking routine.
To supply an alternate checking routine, use the "checker" option to
the cmp() method of the correct answer object. For example:
sub check {
my ($correct,$student,$ans) = @_;
return 0 unless $correct->length == $student->length;
my ($x,$y) = $student->value; # break up a point;
return $x**2 - $y**2 = 1; # check if it is on a hyperbola
}
Point(1,0)->cmp(checker=>~~&check);
This will check if the student's point lies on the given hyperbola. All
the usual error messages will be issued if the student's answer is not
a point, or is of the wrong dimension, etc.
You can use
sub list_check {
my ($correct,$student,$ans) = @_;
my @correct = @{$correct}; my @student = @{$student};
...
return ($score,@errors);
}
List(...)->cmp(list_checker=>~~&list_check);
to replace the list-checking routine with your own custom one. The
$correct and $student values are array references to the elements in
the lists provided by the professor and student. (Note that you do
NOT get a List() object; this allows you to handle lists of formulas,
since a List of formulas becomes a formula returning a list). The
checker routine should return the number of correct elements in the
student's list ($score), and a list of error messages produced while
checking the two lists (@errors). (This is a list of messages, since
you might want to include an error for each entry in the list, for
example).
If your checker or list_checker routine wants to die with an error
message, use Value::Error(message). This will put the message in the
WeBWorK display area at the top of the page. If you use die(message),
or if the code fails due to a runtime error, then "pink screen of
death" will be produced indicating the error and asking the student to
report the error to the professor.
Revision
3205 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Mar 29 02:55:10 2005 UTC (14 years, 8 months ago) by
dpvc
File length: 23319 byte(s)
Diff to
previous 3172
Properly handle string values in postprocessing of vectors and other
related lists. (It used to report a dimension error for things like 'NONE').
Revision
3172 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Feb 15 21:58:54 2005 UTC (14 years, 10 months ago) by
dpvc
File length: 22808 byte(s)
Diff to
previous 2916
Updated the answer checkers so that you can more easily specify how
the correct answer shoudl be displayed. In the past, you could use
something like Real(sqrt(2))->cmp(correct_ans=>"sqrt(2)") to do this,
but that is awkward. Now the Compute() function (which parses and
then evaluates a string) sets things up so that the original string
will be what is used as the correct answer. That means
Compute("sqrt(2)")->cmp will have the same result as the example
above.
You can also set the {correct_ans} properly of any Parser object to
have that value used as the correct answer. For example
$x = Real(sqrt(2));
$x->{correct_ans} = "sqrt(2)";
ANS($x->cmp)
would also produce the same answer checker as the two previous
examples. All three methods should work. Use the one that is most
convenient for you.
Revision
2916 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Oct 13 18:41:07 2004 UTC (15 years, 2 months ago) by
dpvc
File length: 22636 byte(s)
Diff to
previous 2900
Clear error messages before doing the answer check (this clears old
messages left over inclass this checker is called by another one,
e.g. when using UNORDERD_ANS()).
Revision
2799 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Sep 19 11:49:32 2004 UTC (15 years, 2 months ago) by
dpvc
File length: 22468 byte(s)
Diff to
previous 2791
Added a new flag to the Formula()->cmp answer checker that allows a
constant-valued formula to be evaluated and then use the checker for
the resulting type. This is useful when you want the correct answer
for a numeric check to be shown in a symbolic form (like "pi/4")
rather than as a decimal number. To do this, use
Formula("pi/4")->cmp(eval=>1);
rather than Real(pi/4)->cmp, which would show the correct answer as
0.785398. Note that Formula("pi/4")->cmp would also match against
pi/4, but it does it as a function rather than a number, so error
messages might be issued indicating that the checker is expecting a
formula that returns a number, rather than just a number; this might
be confusing to a student. It would also accept answers like
"pi/4-x+x" as correct, whereas with eval=>1 this would produce an
error message saying that the answer was supposed to be a number not a
formula returning a number.
Similarly, if you want to show sqrt(2)/2 as the correct answer, use
Context()->flags->set(reduceConstants=>0, reduceConstantFunctions=>0);
Formula("sqrt(2)/2")->cmp(eval=>1);
The first line tells the parser not to automatically reduce
expressions that only involve constants, so that the value of the
formula in the second line will not be reduced to a decimal before
the cmp method is called.
Revision
2791 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Sep 16 23:43:54 2004 UTC (15 years, 3 months ago) by
dpvc
File length: 22346 byte(s)
Diff to
previous 2790
Don't reduce constants in the display of student answers (so they can
tell how the parser interprets their answer). The drawback is that
the final number is not displayed. (We may need to add more columns
to the results display.)
Revision
2790 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Sep 16 23:03:03 2004 UTC (15 years, 3 months ago) by
dpvc
File length: 22063 byte(s)
Diff to
previous 2772
Use extra parens in the string version of the student's answer, but
not in the professor's (unless the problem sets the showExtraParens
flag).
Revision
2757 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Sep 10 14:50:14 2004 UTC (15 years, 3 months ago) by
dpvc
File length: 21909 byte(s)
Diff to
previous 2692
No longer produces the message that there are too many answers if
hints are being shown about individual entries in a list. (This gave
away the answer about which ones to remove.)
Revision
2688 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Aug 27 19:42:59 2004 UTC (15 years, 3 months ago) by
dpvc
File length: 21882 byte(s)
Diff to
previous 2687
Added in functMaxConstantOfIntegration support in the adaptive
parameter answer checking. Also added a flag to the formula answer
checker that allows checking a formula up to a constant (for
integration problems). This really just adds a new parameter to the
context and adds that to the formula, so there is nothing deep about
this.
ANS(Formula("2x")->cmp(upToConstant=>1));
Finally, don't look for adaptive parameters if they aren't actually
used in the professor's formula (even if they are defined).
Revision
2687 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Aug 27 00:28:27 2004 UTC (15 years, 3 months ago) by
dpvc
File length: 21305 byte(s)
Diff to
previous 2671
Added ability to have linear adaptive parameters in the function
answer checker. It only works for real-valued functions, though.
To use a parameter, use
Context()->variables->add(a=>'Parameter');
and then use 'a' as a variable within your answer. The student will
not be allowed to enter the parameter, but the professor will.
Note that the correct answer will show the full professor's answer,
including the parameters, even though the student can't type it. Is
this the right behaviour?
Revision
2671 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Aug 22 21:18:06 2004 UTC (15 years, 3 months ago) by
dpvc
File length: 21142 byte(s)
Diff to
previous 2667
Fixed some inconsistencies between handing of matrices within the
parser and Value packages. Added a predefined Matrix context.
Revision
2664 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 21 22:02:14 2004 UTC (15 years, 3 months ago) by
dpvc
File length: 20722 byte(s)
Diff to
previous 2661
Added a file to perform WeBWorK-specific modifications to the
Parser/Value packages. (I've tried to make these independent of
WeBWorK, so you can use them in other perl code if you want to.)
The parameters for fuzzy reals and some of the other parameters now
are taken from the pg->{ansEvalDefaults} values (as defined in
global.conf or course.conf). More still needs to be done with this,
however.
Revision
2661 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Aug 20 15:56:56 2004 UTC (15 years, 3 months ago) by
dpvc
File length: 20653 byte(s)
Diff to
previous 2656
A number of fixes to make handing lists work better. In particular,
you can now specify checks for whether the right kinds of parentheses
(or none at all) are used on the student's answer. Some of the flags
for the list checker have been changed to accommodate this.
Revision
2648 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Aug 19 12:38:47 2004 UTC (15 years, 3 months ago) by
dpvc
File length: 19548 byte(s)
Diff to
previous 2634
The answer checkers now work with subclasses of Formulas that are not
part of the Value:: package tree itself (we call Value::isFormula()
rather than checking the class directly).
I also removed the various cmp_* flags that stored method names as
they ended up not needing to be used (they were intended as a means of
overriding the default method names, but subclassing turned out to be
a better approach).
I moved some initialization of the answer checker out of the anonymous
subroutine that is installed in the checker and just have that
subroutine call the correct answer's main checker (which I renamed).
Finally, I changed the student_ans value to be an HTMLized version of
the student answer, since the student could include things like < in
his answer (e.g., for vectors), in which case his whole answer might
disappear. I wonder if this couldn't be handled better at a higher
level, as it seems wrong to make the student_ans be HTML rather than
the parsed string. I originally thought Problem.pm could do the
protecting of HTML special characters, but this won't work without
additional changes, since some answer checkers put HTML into
student_ans to mark sytanx errors in the student answer, and you DON'T
want to protect those HTML characters. The student_ans field is
probably being misused in this, and there might want to be another
field that gets used by Problem.pm in place of student_ans (which can
be HTML protected) when it is non-empty; say student_HTML or something
like that. The answer checkers could use that field if it wants to
add HTML to the student answer, and student_ans otherwise, with the
assurance that it's HTML characters will be protected. That way, if a
second answer checker calls the first (like some list checkers do),
then the second checker doesn't have to worry about removing HTML from
the student ans, and doesn't ahve to wonder whether the student_ans
actually contains an error message or syntax markings rather than the
actual student answer.
Revision
2634 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Aug 17 15:21:58 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 19750 byte(s)
Diff to
previous 2632
Changed the string used for the student answer to be taken from the
unevaluated formula rather than the fully-evaluated one. This leaves
constants unreplaced, for one thing.
Currently the parser combines constants automatically during the parse
[which should be controllable by a flag], so student answers that
produce numbers are fully evaluated at this point already, except for
constant substitution. This could be changed so that even for
numberic results, the student sees the parsed expression (rather than
the numeric result), which might help them identify where they and the
parser differ in their interpretation. It is still nice to see the
final computed result, however, but there is no place to show the
parsed input as well as the final result. One solution would be to
add another column (wasting space). Another would be to make the
value shown be "parsed-value = computed-value" when they are not the
same thing. A bit ugly, but works within the current framework.
Revision
2629 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Aug 17 02:01:27 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 19792 byte(s)
Diff to
previous 2627
Fixed a number of minor problems with creating perl functions from
formulas (this is done automatically as part of the function answer
checker, so is showing up now that I have that checker in place).
Also improved error messages in the function answer checker, and fixed
a bug when students enter a constant list or union when the answer
checker expects formulas.
Revision
2627 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Aug 16 20:22:16 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 19426 byte(s)
Diff to
previous 2626
Removed unwanted side-effects of some type-match checks, and moved the
ignoreStrings flag so that it is available for the checkers of ANY type.
Revision
2626 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Aug 16 19:44:26 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 19577 byte(s)
Diff to
previous 2624
One more fix for handling intervals properly (I think it's really
right this time). Also, named constants that end in numbers will
produce TeX output with the number as a subscript (this was already
true for variable names).
Revision
2624 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Aug 16 13:44:45 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 19576 byte(s)
Diff to
previous 2622
Added support for unorderd list or formulas with partial credit.
Fixed type mismatch reporting in formula answer checker.
Fixed an error with Unions producing incorrect perl versions under
some circumstances.
Revision
2622 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Aug 15 22:46:57 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 18104 byte(s)
Diff to
previous 2621
Created the first draft of the Parser's function answer checker. Some
work still needs to be done, in particular, type mismatches are not
being reported, and lists are being processed only as ordered lists
with no partial credit.
This doesn't implement everything from fun_cmp. In particular, there
is no support for parameter matching at the moment. This will have to
be added, but I'm not quite sure how to do it when the function's
return value is not a real number (e.g., an interval).
On the other hand, this checker is more forgiving about domain errors:
if tries a point where the professor's function is not defined, it
ignores that one and looks for another (until it decides it can't find
one). Once it has these points, it tries them on the student's
answer, and if the student's function is undefined, then the student
answer is wrong (since it is not defined somewhere that the
professor's funciton is). This avoids the "Error evaluating student
function at ..." messages, which just confused most students anyway.
Revision
2621 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Aug 15 17:05:41 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 17162 byte(s)
Diff to
previous 2617
Improved error messages, particularly when the student enters a
formula in an answer that should be constant, and also for incorrect
answers in lists of answers. There are a few other miscellaneous output
improvements as well.
Revision
2617 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Aug 15 00:13:38 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 16068 byte(s)
Diff to
previous 2612
The Union answer checker now uses the generic List checker, so that it
will be able to produce partial credit and hints about which Intervals
are correct.
Revision
2609 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 14 13:54:52 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 15496 byte(s)
Diff to
previous 2606
Added a String type to the Value package. Mostly this is to make it
possible to generate an answer checker for it that uses the parser.
It also makes it more consistent for handling things like stringify,
especially when they are recursively called internally.
Added new default strings "NONE" and "DNE", since these get used a
lot.
Modified how the default parameters are set up for the answer
checkers, and how the answer checker reports the expected answer type
in type mismatch error messages.
Revision
2606 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 14 11:25:47 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 14844 byte(s)
Diff to
previous 2605
Can now specify that the objects stringify themselfs in their TeX
forms rather than their answer-string forms. This makes it easier to
use the objects in the text of a problem (without having to call ->TeX
explicitly each reference).
Use
Context()->texStrings
to start outputting TeX strings, and
Context()->normalStrings
to switch back.
Revision
2605 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Aug 14 02:50:18 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 14816 byte(s)
Diff to
previous 2604
Incorporated infinities into Parser package better. They have been
stored as String objects (with extra data) in the parser, and I've
left it that way, but now they convert to/from Vallue::Infinity
objects correctly, and these are used for generating the output.
Also added the Infinity answer checker, and adjusted the error
messages produces by type mismatches in the answer checkers and
elsewhere.
Revision
2601 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Aug 13 19:06:09 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 13956 byte(s)
Diff to
previous 2600
Added ability to report incorrect coordinates in point and vector
answers, and incorrect endpoints and endpoint types in intervals.
Separated these kinds of checks from the typeMatch check, where they
didn't really belong.
Added ability to specify intervals and unions as strings in Interval()
and Union(), which makes it easier to make constants of these types.
There are still problems comparing intervals that contain infinities;
I really need to make the infinity object to solve this, so have put
off trying to fix that for now.
Revision
2599 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Aug 13 14:19:23 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 11651 byte(s)
Diff to
previous 2597
The List object's answer checker is now considerably improved. It
will allow you to specify an unorderd or ordered check, and whether to
print various kinds of hints for wrong answers.
The checker can return partial credit, but WW doesn't deal well with
this at the moment (some small changes to Problem.pm can take care of
that). Partial credit should be based on $showPartialCorrectAnswers,
but it is disabled for now.
The list answer checker probably still needs some work, especially
with non-numeric lists.
Revision
2597 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Aug 13 11:38:22 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 8048 byte(s)
Diff to
previous 2596
Added answer checker for parallel vectors.
Added option to number checker to have it not report type mismatches
for the known strings (like 'infinity'). (Really need a class for
infinities, and a Value.pm class for strings.)
Revision
2594 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Aug 12 20:17:18 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 7060 byte(s)
Diff to
previous 2593
Fixes for handling intervals better. In particular, deal better with
ambiguous situations, like (1,2) that could be a point.
You can use [a,a] to specify the single point a. I'd like to make {a}
represent this (and maybe even {a,b,c} to form finite sets), but this
would interfere with the use of { and } as alternative parentheses.
(Does anyone really use these?)
Do we need a cross product for intervals (and sets) as a means of
representing regions in R^2 (or higher)?
Revision
2593 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Added
Thu Aug 12 16:48:52 2004 UTC (15 years, 4 months ago) by
dpvc
File length: 6598 byte(s)
This is a preliminary attempt at adding answer checkers that use the
parser. If you have a parser object (like a formula or a vector), you
can use the ->cmp method to get an answer checker appropriate for the
object. For example:
Context('Vector');
$v = Vector(1,2,3);
# print text of problem
ANS($v->cmp);
would produce an answer checker that matched against the vector <1,2,3>.
Most of the parameters are set in the Context, but additional ones can
be passed to the checker (this still needs work).
See the sample problems for more examples.
The checkers for Reals, Complexes, Points, Vectors, Matrices and
Intervals work pretty well. The ones for List and Union objects need
more work, as they only do an ORDERED check at the moment (the student
answers must be in the same order). This needs to be fixed.
The checker for Formula objects (which corresponds to fun_cmp) still
needs to be written.
This form allows you to request diffs between any two revisions of this file.
For each of the two "sides" of the diff,
enter a numeric revision.