Expression Minimsation



On 3/30/07, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> On 3/30/07, Dave Gee <aspiceq at yahoo.co.uk> wrote:
> > I have a question about getting expressions into their shortest, most readable form.
> > (R3 + R2 + R1 ) R5 + ( R3 + R2 + R1 ) R4 + ( R2 + R1 ) R3

You can also do an exhaustive search of factorizations of partitions
of the expanded sum. This gets the following three equivalent
expressions using two multiplications:

r3*(r5+r4)+(r2+r1)*(r5+r4+r3)       (2M 5A)
(r2+r1)*r3+(r3+r2+r1)*(r5+r4)       (2M 5A)
(r2+r1)*(r5+r4)+r3*(r5+r4+r2+r1)    (2M 6A)

Pulling out the r3^2 requires more imagination....  More playing gets us

(r3+r2+r1)*(r5+r4+r2+r1)-(r2+r1)^2       (2m 7a)
(r1r2:r1+r2, (r3+r1r2)*(r5+r4+r1r2)-(r1r2)^2  (2m 5a)

Any of these might "reflect underlying symmetries", too.... and each
has slightly different rounding properties.

                -s