[LON-CAPA-users] Re: ERROR: Computer's answer is incorrect ("0").
Justin Gray
lon-capa-users@mail.lon-capa.org
Wed, 4 May 2011 00:06:14 -0700
--20cf3054a561aaaaf304a26de589
Content-Type: text/plain; charset=ISO-8859-1
Further to this, I created a simplified version of this problem to reproduce
the error:
<problem>
<script type="loncapa/perl">
$a=&random(1,2,1);
$b=&random(1,2,1);
$ans=$a-$b;
</script>
<startouttext />
Enter the answer <m eval="on">$$ans$</m>:
<endouttext />
<formularesponse samples="x@1:5#4" answer="$ans">
<responseparam name="tol" type="tolerance" default="1%"
description="Numerical Tolerance" />
<textline readonly="no">
</textline>
</formularesponse>
</problem>
I have discovered that the error (triggered by a 0 answer) disappears when I
change the relative tolerance to an absolute tolerance.
Justin
Justin Gray | Senior Lecturer
Department of Mathematics | Simon Fraser University
8888 University Drive, Burnaby | V5A 1S6 | Canada
Tel: +1 778.782.4237
On Tue, Apr 19, 2011 at 9:09 AM, Justin Gray <jgray@math.sfu.ca> wrote:
> A local high school teacher sent me the problem below. For some reason, it
> seems to generate the following error message when the answer to either part
> is 0:
>
> *ERROR: *Computer's answer is incorrect ("0").
>
> Students that get this version of the problem receive the feedback
> Unable to understand formula
>
> The answers are calculated in Perl and evaluated using formula response
> with sampling. Can someone tell me what he needs to do to fix it? I have
> copied the XML below my signature.
>
> Many thanks,
> Justin
>
> Justin Gray | Senior Lecturer
> Department of Mathematics | Simon Fraser University
> 8888 University Drive, Burnaby | V5A 1S6 | Canada
> Tel: +1 778.782.4237
>
> <problem>
> <script type="loncapa/perl">
> $a=&random(1,11,2)*&random(-1,1,2);
> $b=&random(2,12,2)*&random(-1,1,2);
> $c=&random(12,36,3)*&random(-1,1,2);
> $d=&random(1,20,1)*&random(-1,1,2);
> if ($b > 0) {$b = "+" . $b;}
> $xp=($c-$b*$d)/($a-$b);
> $yp=($c-$a*$d)/($b-$a);
> $xm=($c+$b*$d)/($a+$b);
> $ym=($c-$a*$d)/($b+$a);
> $i=&random(1,2,1);
> $n=&choose($i,"+","-");
> $xans=&choose($i,$xp,$xm);
> $yans=&choose($i,$yp,$ym);
> </script>
>
> <startouttext />
> <p> Solve the following system of linear equations. </p>
>
> <p> <m eval="on">$ $a x $b y = $c $</m> </p>
> <p> <m eval="on">$ x $n y = $d $</m> </p>
>
> <p> You can leave your answer in fractional form or convert it to a
> decimal. You choose! </p>
> x =
> <endouttext />
> <part id="31">
> <formularesponse samples="x@1:5#4" answer="$xans" id="32">
> <responseparam name="tol" type="tolerance" default="1%"
> description="Numerical Tolerance" />
>
> <textline readonly="no" size="20" />
> </formularesponse>
> </part>
>
> <part id="33">
> <startouttext />
> y =
> <endouttext />
>
> <formularesponse samples="x@1:5#4" answer="$yans" id="34">
> <responseparam name="tol" type="tolerance" default="1%"
> description="Numerical Tolerance" />
>
> <textline readonly="no" size="20" />
> </formularesponse>
> </part>
> </problem>
>
>
>
>
>
--20cf3054a561aaaaf304a26de589
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Further to this, I created a simplified version of this problem to reproduc=
e the error:<div><br></div><div><div><problem></div><div>=A0=A0 =A0&l=
t;script type=3D"loncapa/perl"></div><div>$a=3D&random(1,2=
,1);</div>
<div>$b=3D&random(1,2,1);</div><div>$ans=3D$a-$b;</div><div>=A0=A0 =A0&=
lt;/script></div><div><br></div><div>=A0=A0 =A0<startouttext /></d=
iv><div>Enter the answer <m eval=3D"on">$$ans$</m>:</=
div><div>=A0=A0 =A0<endouttext /></div>
<div>=A0=A0 =A0<formularesponse samples=3D"x@1:5#4" answer=3D&=
quot;$ans"></div><div>=A0=A0 =A0<responseparam name=3D"tol&=
quot; type=3D"tolerance" default=3D"1%" description=3D&=
quot;Numerical Tolerance" /></div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span><=
textline readonly=3D"no"></div><div><span class=3D"Apple-tab-s=
pan" style=3D"white-space:pre"> </span></textline></div><div>=A0=A0 =
=A0</formularesponse></div>
<div></problem></div><div><br></div><div>I have discovered that the e=
rror (triggered by a 0 answer) disappears when I change the relative tolera=
nce to an absolute tolerance.</div><div><br></div><div>Justin</div><div>
<br></div><div>Justin Gray | Senior Lecturer</div>Department of Mathematics=
| Simon Fraser University<br>8888 University Drive, Burnaby | V5A 1S6 | Ca=
nada<br>Tel: +1 778.782.4237<br><br><div><br></div><div><br><div><br></div>
</div><br>
<br><br><div class=3D"gmail_quote">On Tue, Apr 19, 2011 at 9:09 AM, Justin =
Gray <span dir=3D"ltr"><<a href=3D"mailto:jgray@math.sfu.ca">jgray@math.=
sfu.ca</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"=
margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
A local high school teacher sent me the problem below. For some reason, it =
seems to generate the following error message when the answer to either par=
t is 0:<div><br></div><div><span style=3D"font-family:Verdana, Arial, Helve=
tica, sans-serif;font-size:19px;color:rgb(255, 0, 0)"><b>ERROR:=A0</b>Compu=
ter's answer is incorrect ("0").</span></div>
<div><font color=3D"#FF0000" face=3D"Verdana, Arial, Helvetica, sans-serif"=
size=3D"6"><span style=3D"font-size:19px"><br></span></font></div><div>Stu=
dents that get this version of the problem receive the feedback=A0</div>
<div><span style=3D"font-family:Times;font-size:medium">Unable to understan=
d formula</span></div><div><div><br></div>
<div>The answers are calculated in Perl and evaluated using formula respons=
e with sampling. Can someone tell me what he needs to do to fix it? I have =
copied the XML below my signature.</div><div><br></div><div>Many thanks,</d=
iv>
<div>Justin</div><div><br></div><div>Justin Gray | Senior Lecturer</div>Dep=
artment of Mathematics | Simon Fraser University<br>8888 University Drive, =
Burnaby | V5A 1S6 | Canada<br>Tel: <a href=3D"tel:%2B1%20778.782.4237" valu=
e=3D"+17787824237" target=3D"_blank">+1 778.782.4237</a><br>
<br><div><div><problem></div>
<div>=A0=A0 =A0<script type=3D"loncapa/perl"></div><div>$a=
=3D&random(1,11,2)*&random(-1,1,2);</div><div>$b=3D&random(2,12=
,2)*&random(-1,1,2);</div><div>$c=3D&random(12,36,3)*&random(-1=
,1,2);</div>
<div>$d=3D&random(1,20,1)*&random(-1,1,2);</div><div>if ($b > 0)=
{$b =3D "+" . $b;}</div><div>$xp=3D($c-$b*$d)/($a-$b);</div><div=
>$yp=3D($c-$a*$d)/($b-$a);</div><div>$xm=3D($c+$b*$d)/($a+$b);</div><div>$y=
m=3D($c-$a*$d)/($b+$a);</div>
<div>$i=3D&random(1,2,1);</div><div>$n=3D&choose($i,"+",&=
quot;-");</div><div>$xans=3D&choose($i,$xp,$xm);</div><div>$yans=
=3D&choose($i,$yp,$ym);</div><div>=A0=A0 =A0</script></div><div><=
br></div><div>
=A0=A0 =A0<startouttext /></div><div><p> Solve the following sy=
stem of linear equations. </p></div><div><br></div><div><p> <=
;m eval=3D"on">$ $a x $b y =3D $c $</m> </p></div>=
<div>
<p> <m eval=3D"on">$ x $n y =3D $d $</m> </p=
></div>
<div><br></div><div><p> You can leave your answer in fractional form =
or convert it to a decimal. =A0You choose! </p></div><div>x =3D</div>=
<div>=A0=A0 =A0<endouttext /></div><div><part id=3D"31"&=
gt;</div>
<div>=A0=A0 =A0<formularesponse samples=3D"x@1:5#4" answer=3D&=
quot;$xans" id=3D"32"></div><div>=A0=A0 =A0<responsepa=
ram name=3D"tol" type=3D"tolerance" default=3D"1%&=
quot; description=3D"Numerical Tolerance" /></div>
<div>=A0=A0 =A0</div><div>=A0=A0 =A0 =A0 =A0<textline readonly=3D"n=
o" size=3D"20" /> =A0 =A0</div><div>=A0=A0 =A0</formul=
aresponse></div><div></part></div><div><br></div><div><part id=
=3D"33"></div><div>
=A0=A0 =A0<startouttext /></div><div>y =3D</div><div>=A0=A0 =A0<en=
douttext /></div><div><br></div><div>=A0=A0 =A0<formularesponse sampl=
es=3D"x@1:5#4" answer=3D"$yans" id=3D"34">=
</div><div>=A0=A0 =A0<responseparam name=3D"tol" type=3D"=
tolerance" default=3D"1%" description=3D"Numerical Tole=
rance" /></div>
<div>=A0=A0 =A0</div><div>=A0=A0 =A0 =A0 =A0<textline readonly=3D"n=
o" size=3D"20" /> =A0 =A0</div><div>=A0=A0 =A0</formul=
aresponse></div><div></part></div><div></problem></div></div=
><div><br></div><div><br>
<div>
<br></div></div><br>
</div>
</blockquote></div><br></div>
--20cf3054a561aaaaf304a26de589--