WeBWorK Main Forum

Student answer marked incorrect, then correct

Student answer marked incorrect, then correct

by Darwyn Cook -
Number of replies: 2
Probably something simple, but I cannot figure out what happened with this students answer. They put in a correct answer that was marked incorrect. In subsequent attempts it was marked correct.

http://ppl.ug/6BHWydPTcVU/

The part in question is a randomly generated number being marked as a formula. Here's the code:

DOCUMENT(); # This should be the first executable line in the problem.
loadMacros(
"PGstandard.pl",
"PGunion.pl",
"Parser.pl",
"PGcourse.pl",
"PGanswermacros.pl",
"unionTables.pl",
"Alfredmacros.pl",
"MathObjects.pl"
);


#TEXT(&beginproblem);
BEGIN_PROBLEM();
$showPartialCorrectAnswers = 1;
Context()->variables->are(
x=>'Real',
y=>'Real',
z=>'Real',
r=>'Real',
theta=>'Real',
phi=>'Real',
rho=>'Real'
);

$r= random(2,5);
$z = $r + random(1,4);

### Set limits for the answer checkers, so that for example sqrt(r^2)=r
Context()->variables->set(r=>{limits=>[0,$r]},
theta=>{limits=>[0,2*pi]},
phi=>{limits=>[0,pi]},
rho=>{limits=>[0,arctan($r/$z)]} );
##############################################
# GIF Setup

$size = [150,150]; # the size of the images
$tsize = 300; # tex size of images

#
# The GIF
#
$graph = Image('rightcylinder.gif',size=>$size,tex_size=>$tsize,tex_center=>1);

#######################################################
# Prevent students from being able to double click in
# an answer box. In these problems that will show them
# the code for the answer blank in a pop up, not harmful
# but disruptive.


##############################################
# Main text
Context()->texStrings;
BEGIN_TEXT
\{ BeginTable().
AlignedRow([$graph]).
EndTable();\}
$PAR
The region is a right circular cylinder of radius $r, with the bottom at -$z and top at $z. Find the limits of integration on the triple integral for the volume of the sphere using Cartesian, cylindrical, and spherical coordinates and the function to be integrated. For your answers \(\theta = \) theta, \(\phi = \) phi, and \(\rho = \) rho.
$BR
$BR
Cartesian
$BR
\{ BeginTable(center=>0).
Row(['\(\displaystyle\int_a^b\int_c^d\int_e^f p(x,y,z) dydxdz = \)',tableintegral(width=>10),tableintegral(width=>10),tableintegral(width=>10),ans_rule,'\(\hskip{5pt}dydxdz \)',
],separation=>2).
EndTable();
\}
$BR
Cylindrical
$BR
\{ BeginTable(center=>0).
Row(['\(\displaystyle\int_a^b\int_c^d\int_e^f p(r,\theta,z) drd\theta dz = \)',tableintegral(width=>10),tableintegral(width=>10),tableintegral(width=>10),ans_rule,'\(\hskip{5pt}drd\theta dz\)',
],separation=>2).
EndTable();
\}
$BR
Spherical (which is twice the top half)
$BR
\{ BeginTable(center=>0).
Row(['\(\displaystyle\int_a^b\int_c^d\int_e^f p(\rho,\theta,\phi) d\rho d\phi d\theta =\)', '\(2\Bigg(\)',tableintegral(width=>10),tableintegral(width=>10,lower=>0),tableintegral(width=>10),ans_rule,'\(\hskip{5pt}d\rho d\phi d\theta \)',
],separation=>4).
Row(['','+'],separation=>4).
Row(['','',tableintegral(width=>10),tableintegral(width=>10),tableintegral(width=>10),ans_rule,'\(\hskip{5pt}d\rho d\phi d\theta\Bigg)\)',
],separation=>2).
EndTable();
\}
$BR
END_TEXT
Context()->normalStrings;
##################################################
# Answers - using formula instead of compute gives the student less hints with # their answers, it won't tell them if their answers should be a number.

# Cartesian
ANS(Formula("-$z")->cmp);
ANS(Formula("$z")->cmp);
ANS(Formula("-$r")->cmp);
ANS(Formula("$r")->cmp);
ANS(Formula("-sqrt($r^2-x^2)")->cmp);
ANS(Formula("sqrt($r^2-x^2)")->cmp);
ANS(Formula("1")->cmp);
# Cylindrical
ANS(Formula("-$z")->cmp);
ANS(Formula("$z")->cmp);
ANS(Formula("0")->cmp);
ANS(Formula("2*pi")->cmp);
ANS(Formula("0")->cmp);
ANS(Formula("$r")->cmp);
ANS(Formula("r")->cmp);
# Spherical
# cone
ANS(Formula("0")->cmp);
ANS(Formula("2*pi")->cmp);
#ANS(Formula("0")->cmp);
ANS(Formula("arctan($r/$z)")->cmp);
ANS(Formula("0")->cmp);
ANS(Formula("$z/cos(phi)")->cmp);
ANS(Formula("rho^2*sin(phi)")->cmp);
#base
ANS(Formula("0")->cmp);
ANS(Formula("2*pi")->cmp);
ANS(Formula("arctan($r/$z)")->cmp);
ANS(Formula("pi/2")->cmp);
ANS(Formula("0")->cmp);
ANS(Formula("$r/sin(phi)")->cmp);
ANS(Formula("rho^2*sin(phi)")->cmp);
##################################################

END_PROBLEM();
ENDDOCUMENT(); # This should be the last executable line in the problem.
In reply to Darwyn Cook

Re: Student answer marked incorrect, then correct

by Gavin LaRose -
Hi Darwyn,

I didn't read though your code. There was, however, a significant window in which WeBWorK was picking the points on which to evaluate formula answers each time an answer was submitted---that is, each time there could be different points chosen. This can cause a certain amount of grief when there are rounding issues or local singularities in the solution, so that picking the wrong (or right) point can result in the student's answer not comparing as correct.

I believe that this was corrected at some time in summer 2013 or later. If you're running an older version of WeBWorK (or I'm wrong about the patch date), this could be what you're seeing here.

Gavin

In reply to Gavin LaRose

Re: Student answer marked incorrect, then correct

by Darwyn Cook -
We are having the same issue again. I just updated webwork to run version 2.10. This time the problem involved was a real number, so the points picked should not have been an issue. The code involved is

$r = Real(sprintf("%0.2f",random(0.06, 0.13, 0.01)));
$rate = sprintf("%.0f",100*$r);
$double = Real(int(72/$rate + 0.5));

Making $r a Real and then treating like a regular perl variable may not be the way to go?

ANS($double->cmp());

is the answer checker that failed, but only in one reported case.