WeBWorK Problems

Answer checking not working in new problem

Answer checking not working in new problem

by Hy Ginsberg -
Number of replies: 2
Hi All,

I have an integration problem where I can enter the answer exactly as it appears in the "correct " answer window, but the answer gets marked as incorrect.  I am using FormulaUpToConstant(), which I have successfully used in other problems; I have no idea what is different here.  I have removed all the extraneous pieces, and have a test problem that exhibits the trouble; here it is (I have also attached it, in case that is more convenient): -- Thanks for any help.  - Hy


DOCUMENT();

loadMacros(
"PG.pl",
"PGbasicmacros.pl",
"PGchoicemacros.pl",
"PGanswermacros.pl",
"PGauxiliaryFunctions.pl",
"parserFormulaUpToConstant.pl"
);

$showPartialCorrectAnswers = 1;

$b = 16;

$ans = FormulaUpToConstant("((1/3)*(x^2-$b)^(3/2))");


TEXT(beginproblem());
BEGIN_TEXT
$BR $BR 
Enter the answer: $ans
$BR \{ans_rule( 60) \}
END_TEXT

ANS( $ans->cmp() );

ENDDOCUMENT();

In reply to Hy Ginsberg

Re: Answer checking not working in new problem

by Hy Ginsberg -
Okay, I figured it out -- if you remove the FormulaUpToConstants() and just use the "old style" answer checker, an error arises: "Can't generate enough valid points for comparison"  Changing the answer check to: 

         ANS( $ans->cmp(limits=[$a,$a+5]) );

(where $b is $a squared) fixed the problem.

But I would say that it's a bug that the error message ("Can't generate enough valid points...") gets hidden when FormulaUpToConstants() is used -- the result is that the correct answer is marked incorrect with no further information.

- Hy

In reply to Hy Ginsberg

Re: Answer checking not working in new problem

by Davide Cervone -
I believe that the parserFormulaUpToConstant.pl file was changed several months ago so that such error messages would not be suppressed. That might only be in the develop copy, but the version I'm running does produce the desired message in for your code sample.