# [LON-CAPA-users] Response Math unable to understand formula forincorrect responses

Seema Ali sali at vsb.bc.ca
Mon Jan 30 00:13:55 EST 2012

Thanks again.

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.

Example:
f(x):= 5*x/(x-2);
g(x):= 2*x/(x-5);
is(f(g(x))=x);
false

is(equal(f(g(x)),x));
true

Is there a subtle difference between having the same is() expression in Maxima vs Lon Capa?

-----Original Message-----
From: lon-capa-users-bounces at mail.lon-capa.org on behalf of Gerd Kortemeyer
Sent: Sun 1/29/2012 6:31 PM
To: Discussion list for LON-CAPA users
Subject: Re: [LON-CAPA-users] Response Math unable to understand formula forincorrect responses

Hi,

On Jan 29, 2012, at 3:12 AM, Seema Ali wrote:

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

That's just Maxima's "equal" at work:

(%i5) is(equal(f(g(x)),x));
(%o5)                               unknown

* If the two sides are the same, the equality is always "true"

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

Seems like the simple "=" is more like "identical":

<problem>
<script type="loncapa/perl">
$a = &random(2,6,1) * &random(-1,1,2);$b = &random(7,9,1) * &random(-1,1,2);
$c = &random(7,9,1) * &random(-1,1,2);$d = &random(2,6,1) * &random(-1,1,2);

$num1 = "$a * x + $b";$den1 = "$c * x +$d";

#simplify the expression
$numerator=&cas('maxima',"num(trigsimp(($num1) / ($den1)))");$denominator=&cas('maxima',"denom(trigsimp(($num1) / ($den1)))");

$function = "($numerator)/($denominator)"; </script> <startouttext />Given the function <m eval='on'>$f(x) = \frac{numerator}{denominator}\ ,$</m> determine the equation of the inverse function. <br /> Answer: <m>$f^{-1}(x)=$</m><endouttext /> <mathresponse answerdisplay="Good" cas="maxima" args="$function">
f(x):=RESPONSE[1];
g(x):=LONCAPALIST[1];
is(f(g(x))=x);

</mathresponse>
</problem>

Does this work?

- Gerd.

>  Below is the XML for the problem.
>
> The problem creates a simple rational expression and asks the student to find the inverse function of that expression.
>
> Thanks.
>
>
> <problem>
> <script type="loncapa/perl">$a = &random(2,6,1) * &random(-1,1,2); >$b = &random(7,9,1) * &random(-1,1,2);
> $c = &random(7,9,1) * &random(-1,1,2); >$d = &random(2,6,1) * &random(-1,1,2);
>
> $num1 = "$a * x + $b"; >$den1 = "$c * x +$d";
>
> #simplify the expression
> $numerator=&cas('maxima',"num(trigsimp(($num1) / ($den1)))"); >$denominator=&cas('maxima',"denom(trigsimp(($num1) / ($den1)))");
>
> $function = "($numerator)/($denominator)"; > @args = ($function);
>
> </script><startouttext />Given the function <m eval='on'>f(x) = \Large\frac{$numerator}{$denominator}</m>, determine the equation of the inverse function.
>
> <br />
> Answer: <m>$f^{-1}(x)=$</m><endouttext />
> g(x):=LONCAPALIST[1];
>
> </mathresponse>
>
>
>
>
> </problem>
>
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20120129/16ed7f4a/attachment-0001.html>