# math expressions optimalization

## "Trix" <trix@polbox.com>13 Jun 2002 21:10:18 -0400

From comp.compilers

Related articles
math expressions optimalization trix@polbox.com (Trix) (2002-06-13)
Re: math expressions optimalization Sid-Ahmed-Ali.TOUATI@inria.fr (Sid Ahmed Ali TOUATI) (2002-06-14)
Re: math expressions optimalization misar@rbg.informatik.tu-darmstadt.de (Walter Misar) (2002-06-14)
Re: math expressions optimalization dimock@deas.harvard.edu (Allyn Dimock) (2002-06-14)
Re: math expressions optimalization tomasz@ic.unicamp.br (Tomasz Kowaltowski) (2002-06-17)
| List of all articles for this month |

 From: "Trix" Newsgroups: comp.compilers Date: 13 Jun 2002 21:10:18 -0400 Organization: tp.internet - http://www.tpi.pl/ Keywords: optimize, question Posted-Date: 13 Jun 2002 21:10:18 EDT

Hello.

I`m going to implement simple alghoritm to
optimalize math expressions in terms of
use of memory cells.
E.g.
I have given out=a*b+c*(a+c+d)
then i divide this expression into parts:
x1=a*b
x2=c+d
c3=a+x2
x4=c*x3
x5=x1+x4

To do this step i just convert my expression
to Polish Notation.

Now I run alghoritm which optimalize expression.

Output is:
x1=a*b
x2=c+d
x2=a+x2
x2=c*x2
x1=x1+x2 <- out

So we`ve used only 2 memory cells - not 5 like above.
I`ve written program which do this but I`m not sure
my program works well - I`d like to compare to another
solution.

I don`t know the name of such alghoritm in English
and can find it on the net.

If somebody would provide me with links to web pages