Use expression.doit(). simplify() ought to be doing this as well ( https://github.com/sympy/sympy/pull/2936 and https://github.com/sympy/sympy/issues/6399).
Aaron Meurer On Mon, Jan 26, 2015 at 10:58 PM, almog yalin <[email protected]> wrote: > I'm trying apply the following substitution a(x) = c * b(x) into a'(x) > > a = sympy.Function('a') > b = sympy.Function('b') > c = sympy.Symbol('c') > x = sympy.Symbol('x') > expression = sympy.Derivative(a(x),x) > expression = expression.subs(a(x),c*b(x)) > print expression.simplify() > > I was expecting to get > >> c*Derivative(b(x), x) >> >> but got instead > >> Derivative(c*b(x), x) >> >> Is there a way to move the coefficient c out of the derivative? > > > > -- > 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/66c991ad-fc06-42f3-b46b-d096826df457%40googlegroups.com > <https://groups.google.com/d/msgid/sympy/66c991ad-fc06-42f3-b46b-d096826df457%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAKgW%3D6%2BN%2BU5DS19LSf4bLWORL%2B_T7LnsHeK5BF_OwSM1JnE_Eg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
