<!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] Response Math unable to understand formula forincorrect responses</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Thanks again.<BR>
<BR>
I tried out some expressions in Maxima with the = sign and it was giving a false value, so I thought that the composition expression wasn't simplified to x and that is why it was giving a false response, so I used equal() instead, which worked in Maxima for me.<BR>
<BR>
Example:<BR>
f(x):= 5*x/(x-2);<BR>
g(x):= 2*x/(x-5);<BR>
is(f(g(x))=x);<BR>
    false<BR>
<BR>
is(equal(f(g(x)),x));<BR>
    true<BR>
<BR>
Is there a subtle difference between having the same is() expression in Maxima vs Lon Capa?<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: lon-capa-users-bounces@mail.lon-capa.org on behalf of Gerd Kortemeyer<BR>
Sent: Sun 1/29/2012 6:31 PM<BR>
To: Discussion list for LON-CAPA users<BR>
Subject: Re: [LON-CAPA-users] Response Math unable to understand formula forincorrect responses<BR>
<BR>
Hi,<BR>
<BR>
<BR>
<BR>
On Jan 29, 2012, at 3:12 AM, Seema Ali wrote:<BR>
<BR>
> If the answer is correct, it will accept it as correct but if it is incorrect the Unable To Understand Formula error pops up and I would prefer if it said Incorrect instead.  Is there something that I have set up incorrectly?<BR>
<BR>
That's just Maxima's "equal" at work:<BR>
<BR>
(%i5) is(equal(f(g(x)),x));<BR>
(%o5)                               unknown<BR>
<BR>
* If the two sides are the same, the equality is always "true"<BR>
<BR>
* If the two sides are not the same, Maxima goes "how would I know, since you didn't tell me what x is!" - and says "unknown".<BR>
<BR>
Seems like the simple "=" is more like "identical":<BR>
<BR>
<problem><BR>
<script type="loncapa/perl"><BR>
$a = &random(2,6,1) * &random(-1,1,2);<BR>
$b = &random(7,9,1) * &random(-1,1,2);<BR>
$c = &random(7,9,1) * &random(-1,1,2);<BR>
$d = &random(2,6,1) * &random(-1,1,2);<BR>
<BR>
$num1 = "$a * x + $b";<BR>
$den1 = "$c * x + $d";<BR>
<BR>
#simplify the expression<BR>
$numerator=&cas('maxima',"num(trigsimp(($num1) / ($den1)))");<BR>
$denominator=&cas('maxima',"denom(trigsimp(($num1) / ($den1)))");<BR>
<BR>
$function = "($numerator)/($denominator)";<BR>
</script><BR>
<startouttext />Given the function<BR>
<m eval='on'>\[f(x) = \frac{$numerator}{$denominator}\ ,\]</m><BR>
determine the equation of the inverse function.<BR>
<BR>
<br /><BR>
Answer: <m>$f^{-1}(x)=$</m><endouttext /><BR>
<mathresponse answerdisplay="Good" cas="maxima" args="$function"><BR>
    <answer><BR>
f(x):=RESPONSE[1];<BR>
g(x):=LONCAPALIST[1];<BR>
is(f(g(x))=x);<BR>
</answer><BR>
    <textline readonly="no" /><BR>
  <BR>
</mathresponse><BR>
</problem><BR>
<BR>
Does this work?<BR>
<BR>
- Gerd.<BR>
<BR>
<BR>
<BR>
<BR>
>  Below is the XML for the problem.<BR>
><BR>
> The problem creates a simple rational expression and asks the student to find the inverse function of that expression.<BR>
><BR>
> Thanks.<BR>
><BR>
><BR>
> <problem><BR>
> <script type="loncapa/perl">$a = &random(2,6,1) * &random(-1,1,2);<BR>
> $b = &random(7,9,1) * &random(-1,1,2);<BR>
> $c = &random(7,9,1) * &random(-1,1,2);<BR>
> $d = &random(2,6,1) * &random(-1,1,2);<BR>
><BR>
> $num1 = "$a * x + $b";<BR>
> $den1 = "$c * x + $d";<BR>
><BR>
> #simplify the expression<BR>
> $numerator=&cas('maxima',"num(trigsimp(($num1) / ($den1)))");<BR>
> $denominator=&cas('maxima',"denom(trigsimp(($num1) / ($den1)))");<BR>
><BR>
> $function = "($numerator)/($denominator)";<BR>
> @args = ($function);<BR>
><BR>
> </script><startouttext />Given the function <m eval='on'>f(x) = \Large\frac{$numerator}{$denominator}</m>, determine the equation of the inverse function.<BR>
><BR>
> <br /><BR>
> Answer: <m>$f^{-1}(x)=$</m><endouttext /><BR>
> <mathresponse answerdisplay="Good" cas="maxima" args="@args"><BR>
>     <answer>f(x):=RESPONSE[1];<BR>
> g(x):=LONCAPALIST[1];<BR>
> is(equal(f(g(x)),x));</answer><BR>
>     <textline readonly="no" /><BR>
>   <BR>
> </mathresponse><BR>
><BR>
><BR>
><BR>
><BR>
> </problem><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>
_______________________________________________<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>