MathGroup Archive 1993

[Date Index] [Thread Index] [Author Index]

Search the Archive

When do we get common subexpression elemination in Mma ?

  • To: Mma-Group<mathgroup at>
  • Subject: When do we get common subexpression elemination in Mma ?
  • From: Erland Wittkoetter <erland at>
  • Date: Sat, 28 Aug 93 15:21:30 -0600


If have got the new Mathematica Version 2.2 and I think some of the
new features are nice and useful, but on the side I am disappointed.
A main step in improving the kind of displaying of very large
expressions are still missing!

 Very large expressions are often unreadable. From Macsyma I know the 

concept of E-Expressions. The idea is to split the complete 

expressions in subexpressions. E.g:
     e[1]:= f[...] 

     e[2]:= g[...]
     e[3]:=Sqrt[e[1]^2 + e[2]^3]
     res:= h[e[1],..,e[i] ];

My suggestion to the developer of Mma is to install some 

functions in the next version, which split expressions in this way.

The subexpressions could be optimized similar to optimization in
numerical computation: What is the cost to evaluate the result:
      How many used functions
       "   "   multiplications
       "   "   divisions
       "   "   additions
       "   "   assignments
       "   "   subexpressions
The internal countweight of this operations should also be 

accessable via an option list. This kind of optimization
should be a function, which one can apply to a symbolic 

expression. E.g.
      OptimizeOutput[expr,<name of an array:A>]

      {{Rules of the structure A[i]->f[x,A[j1<i],..,A[jn<i] ]
        }, newexpr[A[j1<i],..,A[jn<i]]

Another nice option would be:

      OptimizeOutput[expr,<name of an array:A> 

                   ,{List of useful substitutions}];

I think, that the algorithms to find the optimal (best) decomposition
is too cpu/time consuming, so that writing this in a package (by 

using the mma programming language) would be hopeless. 

Further it would be nice to have a global option, to force  

Mathematica to make the computation more with the common 

subexpressions A[] then with single terms. 

In some computations, this could be faster and more transparent 

to the users.

So my question to this forum of mma experts is, would you agree, that
the missing of optimizations in displaying outputs and in getting 

functions for elimination common subexpression are still a big
deficit in Mathematica. 

Maple and Macsyma is able to do this kind of optimization. I really
prefer to work on one software platform, than changing the 

output expressions from one system to another and back.

Best greeting 

 Erland Wittkoetter
-_-_-_-_-_-_-_-_-_-_-_-_- Erland Wittkoetter -_-_-_-_-_-_-_-_-_-_-_-_
Uni Konstanz, Dept.of Physics, LS Dehnen, PO.Box 5560, 78434 Konstanz
 Phone: +(49) 7531-88-3747	 FAX. +(49) 7531-88-3888
(priv.) Abendbergweg 7, 78465 Konstanz,Germany, Phone:+(49)7531-43078
E-mail: erland at

  • Prev by Date: Re: Is this a bug in AbsArg?
  • Next by Date: Re: check identity of lists
  • Previous by thread: Jordan Normal Form
  • Next by thread: Reading MATLAB *.MAT files into Mathematica and vice versa