I don't know enough about what you are doing to know if this will work for that, but for this, you can just use subs to replace b*c with a
In [7]: (2*b*c).subs(b*c, a) Out[7]: 2⋅a Aaron Meurer On Tue, Sep 20, 2011 at 1:47 PM, dennis <[email protected]> wrote: > Hi, > > i have some symbols which are related to each other. For example: > > a = Symbol('a') > b = Symbol('b') > c = Symbol('c') > > a = b*c > > Now simplifying 2*b*c will of course result in 2*b*c > > print 2*b*c > output: 2*b*c > (2 different symbols) > > Can I somehow say that I prefer a solution with less symbols, so that > it results in: > > print 2*b*c > output: 2*a > (1 symbol) > > I hope my explanation of what I am trying to achieve is precise enough. > > -- > 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.
