This is with a WeBWorK installation that self-identifies as "Version 2.5.0+," but the behavior also appears to exist in 2.5.0beta. It appears that a student answer that evaluates to an undefined value on all points of the evaluation domain is marked correct regardless of the correct answer's value. My test problem is the following.
DOCUMENT();
loadMacros( "PG.pl", "PGbasicmacros.pl", "MathObjects.pl" );
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
Context("Numeric");
my $ans = "e^x";
my $fun = Compute($ans);
BEGIN_TEXT
Enter \($ans\): \{ ans_rule(25) \}
END_TEXT
ANS( $fun->cmp(diagnostics=>1) );
ENDDOCUMENT();
I submitted the answer (-e^2 + e^(x))^(1/2)
, which is everywhere undefined on the default domain [-2,2], and it is marked correct.
So: (1) It seems to me that this is undesirable behavior. Is there a flag to set somewhere that will work around this? And (2) Is it patched in later versions of WeBWorK? This isn't completely useful for me, in that later versions appear to be broken for my purposes, but if I can get a patched version of the appropriate code I can kludge together my production service for now.
Thanks,
Gavin