# [Maxima] rtests in Maxima problem

Stavros Macrakis macrakis at alum.mit.edu
Wed Dec 1 14:11:13 CST 2010

```First of all, as RJF says, a lot of Maxima simply doesn't work correctly
with simp:false.

Assuming that is not a problem in your application, if you want to compare
two things for equality, you need to define what you mean by equality.  Is
-(2) equal to -2?  Is -1*x equal to -(x)? Is x+y equal to y+x? Is 1/x equal
to x^(-1)? Is x/x equal to 1? Is (x-1)/x equal to 1-1/x? etc. etc.  Note
that in the first 4 of these cases, the regular Maxima simplifier simplifies
the two expressions to the same quasi-canonical form; in the last case, only
expand or rat simplifies them to the same form.  And in yet other cases, no
simplifier simplifies the two things to the same canonical form, but

So ... what exactly do you mean by "giving the same answer" in the absence
of simplification?

-s

On Wed, Dec 1, 2010 at 10:09, Chris Sangwin <sangwinc at for.mat.bham.ac.uk>wrote:

>
> Dear Maxima list,
>
> I'm developing some automatic tests of code I'm writing, but I have come
> across the folloing problem.  This is a minimal example.
>
> My code requires
> simp:false.
>
> I define the single function
> s(a,b) := ev(gcd(a,b),simp)\$
>
> Then create a file rtest_s.mac containing
>
> s(x^2-1,x^3-1);
> x-1\$
>
> When I run this with
> batch("rtest_s.mac",test);
> I get the output
>
> ********************** Problem 1 ***************
> Input:
> s(x^2-1,x^3-1) Result:
> x-1
> This differed from the expected result:
> x-1
> 0/1 tests passed
> The following 1 problem failed: (1)
> ************************************************
>
> I'm sure this is because internally the result of the function is given by
> ((MPLUS SIMP) -1 \$X)
>
> whereas "x-1" is represented by
> ((MPLUS) \$X ((MMINUS) 1))
>
> So, they are really different, despite the slightly confusing message
> above!
>
> What is the best approach to using the automatic testing with simp:false?
>
> Thanks
> Chris
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20101201/12d09ceb/attachment.html>
```