how to make results more compact?



On 1/5/07, ZINTEL Gerhard <gerhard.zintel at faurecia.com> wrote:
> EQ1: Zo*C*L+Zo*A*L-Zo*D*K+Zo*B*K-Zo*C*J-Zo*A*J-Zo*D*I+Zo*B*I+B*L-D*J
>
> Now I know the most compact form would be
>
> EQ2: Zo * ((C+A)*(L-J) + (B-D)*(K+I)) + B*L - D*J
>
> How to make MAXIMA finding EQ2 from EQ1?

In general, scanmap(factor,...) doesn't do anything useful, because it
recurses over individual terms; neither does
scanmap(factor,...,bottomup).  Factorsum handles some cases like this,
but not all.  I have written combinatorial search functions for
simpler forms, but they can get very time-consuming.

In this particular case, it seems that the approach to take manually
is fairly straightforward:

     map(factorsum,rat(EQ1,Zo));

or

     dd: divide(EQ1,Zo)$
     Zo*factorsum(dd[1])+dd[2]) ;

Of course, this doesn't generalize to arbitrary expressions....

             -s