I'm sorry, but I don't see what the problem is. Are you saying that it doesn't work when the coefficient is 1? Can you maybe give a simple example to show what you are trying to do, and how it doesn't work?
Aaron Meurer On Wed, Mar 7, 2012 at 2:18 PM, Alan Bromborsky <[email protected]> wrote: > Consider using subs in the following way. You have two sets of noncommuting > bases e_1,...,e_n and h_1,...,h_n and they are related by (summation > convention for repeated indexes): > > e_i = a_ij*h_j and h_i = b_ij*e_j where a_ij and b_ij are sympy scalars > (commuting) > > so you create the following dictionarys: > > e_to_h = {e_i:a_ij*h_h} and h_to_e = {h_i:b_ij*e_j} > > so that if you have a expr linear in an e_i representation and you want to > go to an h_i representation you simply: > > expr.subs(e_to_h) > > or if you have a expr linear in an h_i representation and you want to go to > an e_i representation you simply: > > expr.subs(h_to_e) > > This works unless you have entries in the dictionaries of the form (for > example the first entry in each dictionary): > > e_to_h[e_1] = h_1 and h_to_e[h_1] = e1 > > If you go back and forth between representations you change the keys in the > dictionaries. Is there anyway to avoid this? > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
