# [Maxima] How to make results more compact

miguel lopez miguel39123 at hotmail.com
Wed Jan 10 09:19:28 CST 2007

```miguel lopez <miguel39123 <at> hotmail.com> writes:

> A little improvement: ...

Limitations:

The above toy code is only for expressions with sums of products with no square
or power in it, the code thinks that (a+b) and (-a-b) can't be grouped so it
could be improved a little more, but i will not do it.
Also,clearly the algorithm doesn't provides the minimum length expression, but
in some easy cases it does.

By the way for maxima the simplification  -(a+b) = -a -b is  automatic but
-2*(a+b) is not automatic.
This automatic simplification makes difficult to consider (-a-b) as (-1)*(a+b)
in order to group this kind of terms.

Feel free to use or improve the code if you want, easy things are
easy to do but in order to make something really interesting the algorithm
should be very much improved.  The only aim doing this code  is illustrating
some easy techniques for the easy cases.

By the way, in Z_2 any improvement (on expression without powers) could be used
for simplifying logical circuits, and this is an NP-hard problem.

-Miguel.

```