[LON-CAPA-users] Formula response won't recognize "pi"
SIMIN, GRIGORY
SIMIN at engr.sc.edu
Thu Nov 21 14:53:09 EST 2019
Stuart,
Thank you very much
I did not recognize this difference!
Will try this.
Grigory
-----Original Message-----
From: LON-CAPA-users <lon-capa-users-bounces at mail.lon-capa.org> On Behalf Of Raeburn, Stuart
Sent: Thursday, November 21, 2019 1:27 PM
To: Discussion list for LON-CAPA users <lon-capa-users at mail.lon-capa.org>
Subject: Re: [LON-CAPA-users] Formula response won't recognize "pi"
Grigory,
If you do *not* include a samples attribute in the formularesponse tag, then maxima will be used to compare the submitted formula with the expected answer. This became the default starting with LON-CAPA 2.4.0 (June 2007).
However, if you include sample points in the formularesponse item, and your answer includes pi, see the example here: help.loncapa.org/fom/cache/361.html which shows how to include pi as a "variable" in the sampling points.
For example, the following will grade as correct a submission of:
1/sqrt(4*pi^2*L*C)
<problem>
<script type="loncapa/perl">
$ans = "1/(2*pi*sqrt(L*C))";
</script>
<startouttext />
<p>Enter <m>$ \frac{1}{\sqrt{4\cdot\pi^{2} \cdot L\cdot C}} $</m></p> <endouttext /> <formularesponse answer="$ans" samples="pi,L,C@$pi,.1,.1:$pi,100.,100.#1">
<responseparam name="tol" type="tolerance" default="0.00001" description="Numerical Tolerance" />
<textline readonly="no" size="25" spellcheck="none" /> </formularesponse> </problem>
See: loncapa.msu.edu/adm/help/Formula_Response_Sampling.hlp
for additional information about the format to use for sampling points.
Stuart Raeburn
LON-CAPA Academic Consortium
________________________________________
From: LON-CAPA-users <lon-capa-users-bounces at mail.lon-capa.org> on behalf of SIMIN, GRIGORY <SIMIN at engr.sc.edu>
Sent: Thursday, November 21, 2019 11:03 AM
To: Discussion list for LON-CAPA users
Subject: [LON-CAPA-users] Formula response won't recognize "pi"
Hi all!
I've found a strange issue in some problems requiring formula response.
I have a simple question to enter the formula for the resonant frequency.
An example of correct answer is (in other variations the formula could be a bit more complex than this one)
1/(2*pi*sqrt(L*C))
The correct solution is checked by sampling L and C values.
When I am entering the answer, I can see that LON-CAPA recognizes it because it displays the formatted formula as I am entering it:
[cid:image003.jpg at 01D5A05B.449F5B20]
But when I press submit, I got the response:
"unable to understand formula"
By experimenting with this, I found that the issue happens because of "pi" being a part of the answer.
If pi is replaced with 3.141, everything would work.
But it feels weird asking students to enter 3.141 instead of pi; besides, I don't even want to give them a hint that pi is a part of the answer.
Why is this happening? Apparently LON-CAPA knows what "pi" means because it displays it correctly.
Thanks!
Grigory
More information about the LON-CAPA-users
mailing list