[LON-CAPA-users] Forcing a sigma solution

Seema Ali sali at vsb.bc.ca
Fri Mar 23 11:21:01 EDT 2012

Thanks Gerd,

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. =]

>From Seema

-----Original Message-----
From: lon-capa-users-bounces at mail.lon-capa.org on behalf of Gerd Kortemeyer
Sent: Fri 3/23/2012 3:31 AM
To: Discussion list for LON-CAPA users
Subject: Re: [LON-CAPA-users] Forcing a sigma solution

On Mar 22, 2012, at 11:35 PM, Seema Ali wrote:
> 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

Yes, I would definitely go with Justin's idea.

> 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.

You can have several boxes within the same customresponse.

>  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.
> 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.

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.

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.

I'll be happy to work some more on this later today, just let me know what you need.

- Gerd.

<script type="loncapa/perl">

<startouttext />
Given a sum with the expected result.
<endouttext />

<customresponse answerdisplay="$sample">
<startouttext /><table><tr><td><endouttext />
    <textline size="3" readonly="no" />
<startouttext /></td><td></td><td></td></tr><tr><td><font size="+6">Σ</font></td><td><endouttext />
    <textline readonly="no" />
<startouttext /></td><td>=$answer</td></tr><tr><td><endouttext />
    <textline readonly="no" size="1" />
<startouttext />=<endouttext />
    <textline readonly="no" size="3" />
<startouttext /></td><td></td><td></td></tr></table><endouttext />
<answer type="loncapa/perl">

if ($sum=~/^Error/) { return 'BAD_FORMULA'; }
if ($sum==$answer) { return 'EXACT_ANS'; }
return 'INCORRECT';</answer>



LON-CAPA-users mailing list
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/20120323/02998885/attachment.html>

More information about the LON-CAPA-users mailing list