<div dir="ltr">You can evaluate the answer using Maxima and allow for a tolerance using mathresponse. In Maxima, the constant pi is written as %pi. Here is a possible coding for this problem, which will accept either %pi or a numerical approximation for pi:<div><br></div><div><problem><br><script type="loncapa/perl"><br>$function = "1/sqrt(4*(%pi)^2*L*C)";<br>$answer=&xmlparse('The correct answer is <m eval="on">$\frac{1}{\sqrt{4\cdot\pi^{2} \cdot L\cdot C}}$</m>');<br></script><br><br><startouttext /><br>    <p>Enter <m>$ \frac{1}{\sqrt{4\cdot\pi^{2} \cdot L\cdot C}} $</m></p><br><endouttext /><br><br><mathresponse answerdisplay="$answer" cas="maxima" args="$function"><br>    <answer>is(abs((RESPONSE[1])/(LONCAPALIST[1]) - 1) < 0.01);</answer><br>    <textline readonly="no" size="100" spellcheck="none" /><br></mathresponse><br></problem></div><div><br></div><div>You will probably want to give students some instruction for formatting their answer.</div><div><br></div><div>Best,</div><div>Justin<br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="border:0px;margin:0px;padding:0px;color:rgb(0,0,0);font-family:"Source Serif Pro",sans-serif;font-size:16px"><div style="border:0px;margin:0px;padding:0px"><h3 style="border:0px;margin:1.5rem 0px;padding:0px;font-family:DINWebBold,sans-serif;font-size:2rem"><div style="border:0px;margin:0px;padding:0px;font-family:"Source Serif Pro",sans-serif;font-size:16px"><div style="border:0px;margin:0px;padding:0px"><p style="border:0px;margin:1rem 0px 1.5rem;padding:0px;font-stretch:normal;font-size:12px;line-height:18px;font-family:Arial,Helvetica,sans-serif"><span style="font-weight:normal">--</span></p><p style="font-weight:100;border:0px;margin:1rem 0px 1.5rem;padding:0px;font-stretch:normal;font-size:12px;line-height:18px;font-family:Arial,Helvetica,sans-serif"><b>Justin Gray</b><br>Senior Lecturer | Department of Mathematics<br>Simon Fraser University | SCK 10531<br>8888 University Dr., Burnaby, B.C. V5A 1S6<br>T: 778.782.4237</p></div></div><div style="font-weight:100;border:0px;margin:0px;padding:0px 0px 9.27083px;font-family:"Source Serif Pro",sans-serif;font-size:16px"><div style="border:0px;margin:0px;padding:0px 0px 9.27083px"><div style="border:0px;margin:0px;padding:0px"><div style="border:0px;margin:0px;padding:0px"></div><div style="border:0px;margin:0px;padding:0px"></div><div style="border:0px;margin:0px;padding:0px"></div><div style="border:0px;margin:0px;padding:0px"></div><div style="border:0px;margin:0px;padding:0px"></div><div style="border:0px;margin:0px;padding:0px"></div><img alt="" src="https://www.sfu.ca/content/sfu/communicators-toolkit/tools/brand-tools/on-brand-templates/email-signature/jcr:content/main_content/image_0.img.1280.high.png/1527873607206.png" style="border:0px;margin:0px;padding:0px;max-width:271px;height:auto;width:271px"></div></div></div></h3></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 21, 2019 at 11:14 AM H. K. Ng <<a href="mailto:hkng@fsu.edu">hkng@fsu.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div>
<div dir="ltr">Hi,<br>
<div><br>
</div>
<div>Formularesponse using  cas with maxima works great. </div>
<div><br>
</div>
<div><problem><br>
<script type="loncapa/perl"><br>
$ansa  = &cas('maxima','1/sqrt(4*pi^2*L*C)');<br>
</script><br>
<br>
<startouttext />What is formula for resonant frequency for an LC circuit? <endouttext /><br /><br>
<br>
<startouttext /><m>$ \omega_{res} = $</m><endouttext /><br>
<formularesponse answer="$ansa" id="12"><br>
    <textline readonly="no" /><br>
</formularesponse><br>
<br>
</problem><br>
</div>
<div><br>
</div>
<div>Regards,</div>
<div>-hk</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Nov 21, 2019 at 11:05 AM SIMIN, GRIGORY <<a href="mailto:SIMIN@engr.sc.edu" target="_blank">SIMIN@engr.sc.edu</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div>
<p>Hi all!<u></u><u></u></p>
<p><span style="color:black">I've found a strange issue in some problems requiring formula response.<u></u><u></u></span></p>
<p><span style="color:black">I have a simple question to enter the formula for the resonant frequency.<u></u><u></u></span></p>
<p><span style="color:black">An example of correct answer is (in other variations the formula could be a bit more complex than this one)<u></u><u></u></span></p>
<p><span style="color:black">1/(2*pi*sqrt(L*C))<u></u><u></u></span></p>
<p><span style="color:black">The correct solution is checked by sampling L and C values.<u></u><u></u></span></p>
<p><span style="color:black">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:<u></u><u></u></span></p>
<p><span style="color:black"><img width="429" height="119" id="gmail-m_-3309117221527511361gmail-m_-4797884704070664240Picture_x0020_1" src="cid:16e8f6d3bd56917eb1"></span><span style="color:black"><u></u><u></u></span></p>
<p><span style="color:black"><u></u> <u></u></span></p>
<p><span style="color:black">But when I press submit, I got the response:<u></u><u></u></span></p>
<p><span style="color:black">“unable to understand formula”<u></u><u></u></span></p>
<p><span style="color:black"><u></u> <u></u></span></p>
<p><span style="color:black">By experimenting with this, I found that the issue happens because of “pi” being a part of the answer.<u></u><u></u></span></p>
<p><span style="color:black">If pi is replaced with 3.141, everything would work.<u></u><u></u></span></p>
<p><span style="color:black">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.
<u></u><u></u></span></p>
<p><span style="color:black"><u></u> <u></u></span></p>
<p><span style="color:black">Why is this happening? Apparently LON-CAPA knows what “pi” means because it displays it correctly.<u></u><u></u></span></p>
<p><span style="color:black"><u></u> <u></u></span></p>
<p><span style="color:black">Thanks!<u></u><u></u></span></p>
<p><span style="color:black">Grigory<u></u><u></u></span></p>
<p><span style="color:black"><u></u> <u></u></span></p>
<p><span style="color:black"><u></u> <u></u></span></p>
</div>
</div>
_______________________________________________<br>
LON-CAPA-users mailing list<br>
<a href="mailto:LON-CAPA-users@mail.lon-capa.org" target="_blank">LON-CAPA-users@mail.lon-capa.org</a><br>
<a href="https://urldefense.com/v3/__http://mail.lon-capa.org/mailman/listinfo/lon-capa-users__;!!PhOWcWs!npThfddABuFrPgPy2N5gLLGz_02Hs0mlKSiyGgd0QGK0jAvPgqAmVRpO7BG6$" rel="noreferrer" target="_blank">https://urldefense.com/v3/__http://mail.lon-capa.org/mailman/listinfo/lon-capa-users__;!!PhOWcWs!npThfddABuFrPgPy2N5gLLGz_02Hs0mlKSiyGgd0QGK0jAvPgqAmVRpO7BG6$</a>
<br>
</blockquote>
</div>
</div>

</blockquote></div>