[LON-CAPA-users] exponent in formula response
Peter Riegler
lon-capa-users@mail.lon-capa.org
Wed, 03 Feb 2010 10:26:30 +0100
Hi,
one can find the reason for this in &implicit_multiplication in
response.pm. There the multiplication operator in front auf a power of
10 is given very high binding power. Hence, the division in 1/2*10^4
binds less than the multiplication. Hoever, in 1/2*19^4 division binds
stronger than multiplication.
I am posting this to dev as well as we might want to change this. To
this end we would need to clarify why and if at all we need the
currently implemented special behavior of the multiplication operator.
Peter
Todd Ruskell wrote:
> 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
> Colorado School of Mines
> 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
>>
>
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users@mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
--
Peter Riegler
Fakultät Informatik
Ostfalia Hochschule für angewandte Wissenschaften
Fachhochschule Braunschweig/Wolfenbüttel
Salzdahlumer Str. 46/48
38302 Wolfenbüttel
Fon: ++49 5331 939 31540
http://public.rz.fh-wolfenbuettel.de/~riegler