formularesponse_with_hint.xml 1.31 KB
Newer Older
1 2
<problem>
<script type="loncapa/python">
3
# from loncapa import *
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
x1 = 4 # lc_random(2,4,1)
y1 = 5 # lc_random(3,7,1)

x2 = 10 # lc_random(x1+1,9,1)
y2 = 20 # lc_random(y1+1,15,1)

m = (y2-y1)/(x2-x1)
b = y1 - m*x1
answer = "%s*x+%s" % (m,b)
answer = answer.replace('+-','-')

inverted_m = (x2-x1)/(y2-y1)
inverted_b = b
wrongans = "%s*x+%s" % (inverted_m,inverted_b)
wrongans = wrongans.replace('+-','-')
</script>

<text>
<p>Hints can be provided to students, based on the last response given, as well as the history of responses given.  Here is an example of a hint produced by a Formula Response problem.</p>

<p>
What is the equation of the line which passess through ($x1,$y1) and
($x2,$y2)?</p>

<p>The correct answer is <tt>$answer</tt>. A common error is to invert the equation for the slope.  Enter <tt>
$wrongans</tt> to see a hint.</p>

</text>

<formularesponse samples="x@-5:5#11" id="11" answer="$answer">
 <responseparam description="Numerical Tolerance" type="tolerance" default="0.001" name="tol" /> 
35
 <text>y = <formulaequationinput size="25" /></text>
36 37 38 39 40 41 42 43 44 45
  <hintgroup>
   <formulahint samples="x@-5:5#11" answer="$wrongans" name="inversegrad">
   </formulahint>
   <hintpart on="inversegrad">
    <text>You have inverted the slope in the question.</text>
   </hintpart>
  </hintgroup>     
</formularesponse>
</problem>