[LON-CAPA-users] exponent in formula response

James Mueller lon-capa-users@mail.lon-capa.org
Fri, 29 Jan 2010 13:35:15 -0500

A faculty member has a math problem that uses formula response with  
samples so that students can enter their final expression without  
having to plug it into a calculator.


an acceptable answer  (depending on the randomization) might be

She has noticed an issue when the end-point of the integration is 10.  
A submission such as
is evaluated as incorrect, whereas if the student explicitly adds  
everything works as expected.

So for 10, and only 10, there seems to be a problem.

Any ideas as to How she might fix this problem?
(other than the one I came up with,which is choose random numbers such  
that 10 is never the endpoint of the integration in x)

     <script type="loncapa/perl">
$n=1.123; while ($n !=&roundto($n,1) ){
$a=&random(1,5,1); $b=&random(1,20,1); $n=$b/$a;}
for ($x = 0; $x<=$n; $x+= 0.001) {
      push @X1, $x;
      push @Y1, $b*$x-$a*$x**2;   }
  <startouttext />
<br />
Determine the volume of the solid formed by rotating about the <m>$x$</ 
m>-axis, the region above the <m>$x$</m>-axis and below the curve <m  
eval="on">$\;\;  y = $b x - $a x^2\,$</m>. <p />
<endouttext />
<gnuplot width="400" grid="on" align="center" font="medium"  
height="300" border="on" bgcolor="xffffff" fgcolor="x000000"  
alttag="dynamically generated plot" transparent="off">
      <curve linestyle="lines" name="" color="x8B0000" pointtype="1"  
<p />
<startouttext />Volume of the solid is
<formularesponse answer="$volume1" samples="x@1:4#2" id="11">
<responseparam name="tol" default="0.001" description="Numerical  
Tolerance" type="tolerance" />
         <textline size="55" readonly="no" />
  <m> units $^3$.</m>
<br />Use <m>$\pi=3.14159$</m> and round your answer to 3 decimal  
<br />
You do not need to do calculations. For example <m eval="on">$example  
</m> can be given as  3.14159(7^3/3+(7/2)^2-14exp(2)). <endouttext />