Algorithm for computation sequence
- To: mathgroup at smc.vnet.net
 - Subject: [mg103467] Algorithm for computation sequence
 - From: olliH <oliver.hofherr at googlemail.com>
 - Date: Wed, 23 Sep 2009 07:25:22 -0400 (EDT)
 
Hi i have the following problem that i want do solve with
Matahematica:
For example i have this Input:
Calculation = ( ( a * b ) + ( c + d ) / e ) / f * Cos[g]
What i could do by solving this calculation on a piece of paper is to
calculate the problem in the following order :
First step:
1a: a * b = S1a
1b: c + d =S1b
1c: Cos[g] = S1c
Second step:
2a: S1b / e = S2a
Third step:
3a: S1a + S2a = S3a
Fourth step:
4a: S3a * S1c = S4a
Fifth step:
5a: S4a / f = FINISED
What i want to get from mathematica with the function i don't have jet
is a list with all the calculations in every step:
The output I need from Mathematica:
Input: function[Calculation]
Output:
{{{"1a", a, b, Times}, {"1b", c, d, Plus}, {"1c", g, Cos}}, {"2a",
  S1b, e, Divide}, {"3a", S1a, S2a, Plus}, {"4a", S3a, S1c,
  Times}, {"5a", S4a, f, Divide}}
Many of you will think .. Mathematica does this for you why do you
need this???
Or hey this is so easy :)
I need this function to export VHDL code for implementing these
calculations directly into hardware. And computer engineering was only
a subsidiary subject in my study.
With the Mathematica function Level[] i get something that is near to
that what i want...
Level[Calculation , Infinity, Heads -> True]
But it is still far away from what i need. Becaus this is a problem
that has been solved many times in every computer it should be easy to
find a algorythm or a tool that can do this for me.