Hi Mark,
It looks like you are wanting to display the tolerance in the hint? This can be
done if you set the tolerance as a variable in the script. In the test
environment this works OK. I have not tried to include it in a course.
This problem provides hints if the answer is wrong but within 100% or 500%.
Note that if the answer is within 100%, then both hints display because
anything within 100% is also within 500%.
msu/lira/loncapa examples/conditional hints.problem
Code included here for quick reference:
<problem>
<script type="loncapa/perl">
#Enter the computations here
$a=&random(1,10,0.5);
$b=&random(1,10,0.5);
$c=$a+$b;
$Tolerance = "10%"
</script>
<startouttext />
What is $a + $b?
<endouttext />
<part id="01">
<numericalresponse answer="$c" id="01a">
<responseparam name="tol" type="tolerance" default="$Tolerance"
description="Numerical
Tolerance" />
<textline readonly="no" spellcheck="none" />
<hintgroup showoncorrect="no">
<startouttext /><endouttext />
<numericalhint answer="$c" name="err100" id="11">
<responseparam name="tol" type="tolerance" default="100%"
description="Numerical
Tolerance" />
</numericalhint>
<numericalhint answer="$c" name="err500" id="12">
<responseparam name="tol" type="tolerance" default="500%"
description="Numerical
Tolerance" />
</numericalhint>
<hintpart on="err100">
<startouttext />Your answer is within +- 100%. Required tolerance
$Tolerance.<br /><endouttext />
</hintpart>
<hintpart on="err500">
<startouttext />Your answer is within +- 500%. Required tolerance
$Tolerance.<br /><endouttext />
</hintpart>
<hintpart on="default">
<startouttext />Your answer is off by more than +- 500%. Required tolerance
$Tolerance.<endouttext />
</hintpart>
</hintgroup>
</numericalresponse>
</part>
</problem>
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Lucas, Mark
Sent: Friday, February 16, 2018 10:43 AM
To: [email protected]
Subject: [LON-CAPA-users] Tolerances with Hints
Hi,
I am looking to include a hint in a problem that occurs if a response is inside
a wider
tolerance (5%) but not within the requested tolerance (1%).
I created the following hint code and plugged this into a course to test it.
When I look at the parameters for the problem, the tolerance for id=“11” shows
5% (the tolerance used in the numericalhint tags), not 1%. I found this out
when I purposely entered an answer that was about 3% off and found that I got
it right.
I thought I had done something like this before, but may not have
tested it as rigorously as I thought (or I just may be deluding myself that I’ve
done this before).
Has anyone else tried this before? Is this a feature or a bug?
Thanks!
Mark
<numericalresponse unit="J" format="3s" answer="$W" id="11">
<responseparam name="tol" type="tolerance" default="1%"
description="Numerical Tolerance" />
<responseparam name="sig" type="int_range" default="3,6"
description="Significant Figures" />
<textline />
<hintgroup showoncorrect="no">
<numericalhint unit="J" format="3s" answer="$dEPE" name="wrongSign"
id="12">
<responseparam name="tol" type="tolerance" default="5%"
description="Numerical Tolerance" />
<responseparam name="sig" type="int_range" default="3,6"
description="Significant Figures" />
</numericalhint>
<numericalhint unit="J" format="3s" answer="$W" name="Tol" id="14">
<responseparam name="tol" type="tolerance" default="5%"
description="Numerical Tolerance" />
<responseparam name="sig" type="int_range" default="3,6"
description="Significant Figures" />
</numericalhint>
<hintpart on="wrongSign">
<startouttext />Remember that this is the work done BY the electric
field, not the work done by you.<endouttext />
</hintpart>
<hintpart on="Tol">
<startouttext />In this calculation you are adding a number of
different terms, some of which are
positive and some of which are negative.
There is some benefit to working this problem out algebraically and
finding terms that
might offset each other. Remember that your answer needs to be within
a tolerance of about
$Tolerance.<endouttext />
</hintpart>
</hintgroup>
</numericalresponse>
--
Mark Lucas email:
[email protected]
252D Clippinger Lab phone:
(740)597-2984
Department of Physics and Astronomy fax: (740)593-0433
Ohio University
Athens, OH 45701
_______________________________________________
LON-CAPA-users mailing list
[email protected]
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
_______________________________________________
LON-CAPA-users mailing list
[email protected]
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users