[LON-CAPA-users] {Disarmed} RE: Formula response won't recognize "pi"

SIMIN, GRIGORY SIMIN at engr.sc.edu
Thu Nov 21 14:51:33 EST 2019

Great suggestion!
Thank you!

From: LON-CAPA-users <lon-capa-users-bounces at mail.lon-capa.org> On Behalf Of H. K. Ng
Sent: Thursday, November 21, 2019 2:12 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"


Formularesponse using  cas with maxima works great.

<script type="loncapa/perl">
$ansa  = &cas('maxima','1/sqrt(4*pi^2*L*C)');

<startouttext />What is formula for resonant frequency for an LC circuit? <endouttext /><br />

<startouttext /><m>$ \omega_{res} = $</m><endouttext />
<formularesponse answer="$ansa" id="12">
    <textline readonly="no" />



On Thu, Nov 21, 2019 at 11:05 AM SIMIN, GRIGORY <SIMIN at engr.sc.edu<mailto:SIMIN at engr.sc.edu>> wrote:

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)


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:image001.jpg at 01D5A07B.29C6BE90]

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.



LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org<mailto:LON-CAPA-users at mail.lon-capa.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20191121/140e0d71/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 8375 bytes
Desc: image001.jpg
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20191121/140e0d71/attachment-0001.jpg>

More information about the LON-CAPA-users mailing list