<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>RE: [LON-CAPA-users] Forcing a sigma solution</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Thanks Gerd,<BR>
<BR>
This is exactly what I needed.  I'm going to test out my idea and see how it goes.  If it works out I'll show you guys the problem. =]<BR>
<BR>
>From Seema<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: lon-capa-users-bounces@mail.lon-capa.org on behalf of Gerd Kortemeyer<BR>
Sent: Fri 3/23/2012 3:31 AM<BR>
To: Discussion list for LON-CAPA users<BR>
Subject: Re: [LON-CAPA-users] Forcing a sigma solution<BR>
<BR>
Hi,<BR>
<BR>
On Mar 22, 2012, at 11:35 PM, Seema Ali wrote:<BR>
><BR>
> I'm not sure how to extract information from an ordered triple.  I'm also concerned that students might have a hard time entering the 3 pieces of information correctly.  So I tried to implement Justin's idea<BR>
<BR>
Yes, I would definitely go with Justin's idea.<BR>
<BR>
<BR>
> in a different way by having 3 textboxes, however each text box requires an answer and I would like to use the Math Response to see of a small set of conditions have been satisfied to determine if the response is correct.<BR>
<BR>
You can have several boxes within the same customresponse.<BR>
<BR>
<BR>
>  I also don't really know how to extract the 3 pieces of information and am hoping that RESPONSE[1], RESPONSE[2] AND RESPONSE[3] can be used for the 3 text boxes.<BR>
><BR>
> Below is a copy of the problem with the 3 textboxes.  I'm stuck on the coding part. If anyone has a similar question that uses information from a few different textboxes to see if the answer is correct or another way to implement this type of question and is willing to share, I'd greatly appreciate it.<BR>
<BR>
You can have more than one textbox within the same response, no problem. I did not have much time this morning, but I started coding something for you. It's sort of your setup, but inside-out. It brings up a customresponse with four textboxes and shows how to access the values from within the answer-script.<BR>
<BR>
Inside customresponse, I would then use &cas()-calls to evaluate the sum, using MAXIMA. I haven't done that part correctly (something's wrong), but it's just straight MAXIMA.<BR>
<BR>
I'll be happy to work some more on this later today, just let me know what you need.<BR>
<BR>
- Gerd.<BR>
<BR>
<problem><BR>
<script type="loncapa/perl"><BR>
$answer=&random(3,18,1);<BR>
</script><BR>
<BR>
<startouttext /><BR>
Given a sum with the expected result.<BR>
<endouttext /><BR>
<BR>
<customresponse answerdisplay="$sample"><BR>
<startouttext /><table><tr><td><endouttext /><BR>
    <textline size="3" readonly="no" /><BR>
<startouttext /></td><td></td><td></td></tr><tr><td><font size="+6">&Sigma;</font></td><td><endouttext /><BR>
    <textline readonly="no" /><BR>
<startouttext /></td><td>=$answer</td></tr><tr><td><endouttext /><BR>
    <textline readonly="no" size="1" /><BR>
<startouttext />=<endouttext /><BR>
    <textline readonly="no" size="3" /><BR>
<startouttext /></td><td></td><td></td></tr></table><endouttext /><BR>
<answer type="loncapa/perl"><BR>
$upper=$$submission[0];<BR>
$term=$$submission[1];<BR>
$vari=$$submission[2];<BR>
$lower=$$submission[3];<BR>
<BR>
$sum=&cas('maxima',"sum($term,$vari,$lower,$upper)");<BR>
if ($sum=~/^Error/) { return 'BAD_FORMULA'; }<BR>
if ($sum==$answer) { return 'EXACT_ANS'; }<BR>
return 'INCORRECT';</answer><BR>
<BR>
   <BR>
</customresponse><BR>
<BR>
</problem><BR>
<BR>
<BR>
<BR>
_______________________________________________<BR>
LON-CAPA-users mailing list<BR>
LON-CAPA-users@mail.lon-capa.org<BR>
<A HREF="http://mail.lon-capa.org/mailman/listinfo/lon-capa-users">http://mail.lon-capa.org/mailman/listinfo/lon-capa-users</A><BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>