# [Maxima] Feature request

Richard Hennessy rvh2007 at comcast.net
Mon Apr 21 15:24:58 CDT 2008

```Can you undo this?

------------Original Message------------
From: "Stavros Macrakis" <macrakis at alum.mit.edu>
To: "Richard Hennessy" <rvh2007 at comcast.net>
Cc: "S. Newhouse" <sen1 at math.msu.edu>, "Maxima List" <maxima at math.utexas.edu>
Date: Mon, Apr-21-2008 3:31 PM
Subject: Re: [Maxima] Feature request
Richard,

As Harald points out, it is easy enough to generate exactly the output you want if you turn off simplification.

The reason you can't do this during normal formula manipulation is that Maxima takes advantage of the quasi-canonical form of formulae to make its internal operations faster.  If some additions were of the form x^2+y+y^2 and others of the form y^2+x+x^2, it would be more work to find corresponding terms.

On Mon, Apr 21, 2008 at 3:08 PM, Richard Hennessy <rvh2007 at comcast.net> wrote:

Why is there no commute command?  I would like to
commute(b*y^2+d*x*y+a*x^2);
and get
a*x^2+d*x*y+b*y^2

Very easy to *print out* the latter form:

print_reversed(ex):= block([simp:false], if mapatom(ex) then print(ex)
else print(funmake(op(ex),reverse(args(ex))))\$

There are tricks to make Maxima accept the reversed form as though it were simplified, but you will run into trouble when you try manipulating it:

Warning: this will break many things in Maxima!
:lisp (defun \$makesimp (op ex) (cons (list (\$verbify op) 'simp) (reverse (cdr ex))))
Warning: no error checking!
Warning: pseudo-simplified result!

qq_reversed(ex):= block([simp:false], if mapatom(ex) then ex
else makesimp(op(ex),reverse(args(ex)))\$

but now Maxima's simplification algorithms no longer work in general:

qq_reversed(x+1)-1
=> 1+x-1

As for associativity, again, you can construct pseudo-simplified expressions:

makesimp("+",[a,makesimp("+",[b,c]))

but Maxima's simplifications will no longer work.

-s

-s
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20080421/946a0491/attachment.htm
```