<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks!<br><div><div>On Jun 27, 2012, at 3:26 PM, Gerd Kortemeyer wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,<br><br>On Jun 27, 2012, at 3:24 PM, Lucas, Mark wrote:<br><br><blockquote type="cite">I've got a colleague who wants to write a formularesponse problem such as the <br></blockquote><blockquote type="cite">following:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Simplify -18(v+44)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The problem is that the student should not be able to just type the question in and<br></blockquote><blockquote type="cite">have it come right. He wants it reduced.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Is there a simple way to require this using maxima?<br></blockquote><br>Simple: unfortunately no<br>MAXIMA: yes<br><br>See attached. It uses customresponse to first check for unwanted stuff like parenthesis, and then compares the terms using MAXIMA.<br><br>-Gerd.<br><br><problem><br><br><script type="loncapa/perl"><br>($t1,$t2,$t3,$t4)=&random_permutation(&random(0,1000,1),(<br>'a+b^2',<br>'a+2*b',<br>'a-4*b',<br>'3*a^2+b',<br>'a^2+2*c',<br>'a^2+3*c^2',<br>'2*c-a'));<br>$res1=&cas('maxima',"expand(($t1)*($t2))");<br>$res2=&cas('maxima',"expand(($t3)*($t4))");<br></script><br><br><startouttext /><br><h1>Multiplying Terms</h1><br><endouttext /><br><part id="11"><br><startouttext /><br><p>What is<br><algebra>($t1)*($t2)</algebra><br></p><br><endouttext /><br><customresponse id="12"><br><textline readonly="no" size="70" /><br><br><br>    <answer type="loncapa/perl">if ($submission=~/\,/) { return 'EXTRA_ANSWER'; }<br>if ($submission=~/\)/) { return 'WRONG_FORMAT'; }<br>if ($submission=~/\(/) { return 'WRONG_FORMAT'; }<br>$diff=&cas('maxima',"trigsimp(trigreduce(($t1)*($t2)-($submission)))");<br>if ($diff=~/^Error/) { return 'BAD_FORMULA'; }<br>if ($diff eq '0') { return 'EXACT_ANS'; }<br>return 'INCORRECT';</answer><br><br></customresponse><br><span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span><preduedate><solved><startouttext /><algebra>$res1</algebra><endouttext /></solved></preduedate><br><span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span><postanswerdate><startouttext /><algebra>$res1</algebra><endouttext /></postanswerdate><br></part><br><part id="13"><br><startouttext /><br><p>What is<br><algebra>($t3)*($t4)</algebra><br></p><br><endouttext /><br><customresponse id="14"><br><textline readonly="no" size="70" /><br><br><br>    <answer type="loncapa/perl">if ($submission=~/\,/) { return 'EXTRA_ANSWER'; }<br>if ($submission=~/\)/) { return 'WRONG_FORMAT'; }<br>if ($submission=~/\(/) { return 'WRONG_FORMAT'; }<br>$diff=&cas('maxima',"trigsimp(trigreduce(($t3)*($t4)-($submission)))");<br>if ($diff=~/^Error/) { return 'BAD_FORMULA'; }<br>if ($diff eq '0') { return 'EXACT_ANS'; }<br>return 'INCORRECT';</answer><br><br></customresponse><br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre">    </span><preduedate><solved><startouttext /><algebra>$res2</algebra><endouttext /></solved></preduedate><br><span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span><postanswerdate><startouttext /><algebra>$res2</algebra><endouttext /></postanswerdate><br></part><br></problem><br><br><br><br><br>_______________________________________________<br>LON-CAPA-users mailing list<br><a href="mailto:LON-CAPA-users@mail.lon-capa.org">LON-CAPA-users@mail.lon-capa.org</a><br>http://mail.lon-capa.org/mailman/listinfo/lon-capa-users<br></div></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div>-- <br>Mark Lucas<span class="Apple-converted-space"> </span><span class="Apple-tab-span" style="white-space: pre; ">                                                              </span>email: <a href="mailto:lucasm@ohiou.edu">lucasm@ohiou.edu</a><br>252D Clippinger Lab<span class="Apple-tab-span" style="white-space: pre; ">                                            </span>phone: (740)597-2984<br>Department of Physics and Astronomy<span class="Apple-tab-span" style="white-space: pre; ">                </span>fax: (740)593-0433<br>Ohio University<br>Athens, OH 45701</div></span>
</div>
<br></body></html>