# [LON-CAPA-users] exponent in formula response

Todd Ruskell lon-capa-users@mail.lon-capa.org
Sat, 30 Jan 2010 21:03:54 -0700

James,

Not sure of a work-around, but I suspect I know *why* this is happening:

The expression 400/3*10^3 is ambiguous.   It appears your instructor
would like it to obey the apparent order of operations and evaluate to
400/3*1000.  However, I believe the parser is interpreting this as
400/(3*1000), or 400/3e3, which clearly puts the factor of 1000 in the
denominator.  That is, the parser is too smart for its own good, and
is treating 3*10^3 as a single number written in exponential notation.
One could argue over whether or not this is a "good thing"  but
changing the behavior of the parser at this time would undoubtedly
break many other "working" problems.   So the only fix I really see is
to make sure the students understand that although order of operations
is obeyed, a quantity like 6*10^3 is processed as a single
mathematical entity.

Todd
--
Todd Ruskell, Ph.D.                   Phone: 303-384-2080
Senior Lecturer in Physics          Fax:  303-273-3919
Golden, CO 80401

On Fri, Jan 29, 2010 at 11:35 AM, James Mueller <mueller@pitt.edu> wrote:
> 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.
>
> /res/athanas/c2-volume-1.problem
>
> an acceptable answer Ā(depending on the randomization) might be
> 3.14159*(400/3*19^3-80/4*19^4+4/5*19^5
>
> She has noticed an issue when the end-point of the integration is 10. A
> submission such as
> 3.14159*(400/3*10^3-80/4*10^4+4/5*10^5)
> is evaluated as incorrect, whereas if the student explicitly adds
> parenthesis,
> 3.14159*(400/3*(10^3)-80/4*(10^4)+4/5*(10^5))
> 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)
>
>
> <problem>
> Ā Ā<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; Ā } >$p=($a**2)/5*($n**5)-$a*$b/2*($n**4)+($b**2)/3*($n**3); >$pi=3.14159;
> $volume1="$pi*$p"; >$example=3.14159*(7**3/3+(7/2)**2-14*exp(2));
> Ā</script>
> Ā<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">
> Ā Ā <xlabel>x</xlabel>
> Ā Ā <curve linestyle="lines" name="" color="x8B0000" pointtype="1"
> pointsize="1">
> Ā Ā Ā Ā <data>@X1</data>
> Ā Ā Ā Ā <data>@Y1</data>
> Ā Ā </curve>
> Ā</gnuplot>
> <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" /> > Ā Ā</formularesponse> > Ā<m> units$^3$.</m> > <br />Use <m>$\pi=3.14159$</m> and round your answer to 3 decimal places. > <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 />
> </problem>
>
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users@mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
>