[LON-CAPA-users] Having an equation or a range as a response

Seema Ali sali at vsb.bc.ca
Sun Jan 22 00:05:09 EST 2012


I tested tried it out and it looks good.  Where can I get a list of Maxima questions that Lon Capa uses?  I listed the test cases that I used:

x=0   (for these I forced 0 to be a solution to try it out)

2*x = 10
10 = 2*x



x = 0.25*y
4x -y = 0

I probably didn't have to test out the equations that are "mirror" images (along the equal sing) of a successful equation, but I thought I'd do it anyways, since  I am not familiar with trigsimp and trigreduce.

Thanks this is awesome!

-----Original Message-----
From: lon-capa-users-bounces at mail.lon-capa.org on behalf of Gerd Kortemeyer
Sent: Sat 1/21/2012 7:52 PM
To: Discussion list for LON-CAPA users
Subject: Re: [LON-CAPA-users] Having an equation or a range as a response

On Jan 20, 2012, at 1:49 PM, Seema Ali wrote:

> I'm also super new to Maxima, but can it factor out constants from an expression?  Or could you create a fraction between the left and right side, reduce it and then see if it is the simplified version? Of course being carfeul not to divide by zero. 

I think I got it, please test. If this is good, I might turn it into a template and/or a new responsetype.

Gotta love MAXIMA :-)

- Gerd.

<script type="loncapa/perl">
$sample="x=$b or y=$a*x would be correct";

sub compareequations {
    my ($var,$value,$equation)=@_;
# var is the variable given
# value is the expected value of $var, $var=$value
# equation is the equation to be tested
    if ($reply=~/^Error\:/) { return $reply; }
    if ($reply=~/true/) { return 'true'; }
    return 'false';

<startouttext />
Given an equation for an asymptote of <m eval="on">\[y=$a\cdot x+\frac{1}{x-$b}\]</m>
<endouttext />

<customresponse answerdisplay="$sample">

<answer type="loncapa/perl">
if ($first=~/^Error/) { return 'BAD_FORMULA'; }
if ($first=~/true/) { return 'EXACT_ANS'; }

if ($second=~/^Error/) { return 'BAD_FORMULA'; }
if ($second=~/true/) { return 'EXACT_ANS'; }

return 'INCORRECT';</answer>

    <textline readonly="no" />


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/20120121/3cc469ae/attachment-0001.html>

More information about the LON-CAPA-users mailing list