Dear list,

i am a newby to sympy, and i should say that i liked what i found, so ... 
first of all kudos to the developers.

as of now i can succesfully generate my finite element matrices using 
sympy, which saves me quite a lot of work.

the point is that now i would like to optimize a bit what i did, and i 
would like to collect some common factors between the entries of a matrix.

for example imagine that i have (pseudocode and just an example, no physics 
behind)

a,b = symbols('a b')

A = Matrix(2,1)
A[0] = a*(exp(a+b)+exp(b^2))
A[1] = b*(exp(a+b)+exp(b^2))

i would like a way to detect that the term
(exp(a+b)+exp(b^2))

is common to the different entries and eventually later on do something of 
the type

aux = (exp(a+b)+exp(b^2))
A[0] = a*aux
A[1] = b*aux

note that later on for me it would be still interesting to do something 
similar on SOME of the entries of the matrix

for example if i had 

A = Matrix(3,1)
A[0] = a*(exp(a+b)+exp(b^2))
A[1] = b*(exp(a+b)+exp(b^2))
A[2] = a+b

i would still love to have 


aux = (exp(a+b)+exp(b^2))
A[0] = a*aux
A[1] = b*aux
A[2] = a+b



thanks in advance for any suggestion.

cheers
Riccardo

-- 
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/a72b7481-c0c8-49a2-9a1f-3e88ae8f5f3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to