Hi there,

I just started using sympy for a small code optimization problem that I 
have. 

Let's say I have a bunch of simple, linear expressions (I made these up 
just as an example):

2 * a + (b * c) + 4 * (a + 3 * d)

(b * c) + 2 * (c + 3 * d)

...

I now want to identify common operations in this set of expressions and 
combine them in order to minimize the number of arithmetic operations in my 
program:

y = b * c
z = 3 * d

2 * a + y + 4 * (a + z)
y + 2 * (c + z)


Does sympy have a built-in way to do this? If it doesn't, how would I go 
about it? My idea was to traverse all expression trees and find the longest 
common expressions or something.
Thanks in advance.


Greetings,
Pfaeff




-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/b6deaa42-ef4f-4f8b-bd73-e17b53d015a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to