In general use expr.subs or expr.replace to replace one expression with another.
Aaron Meurer On Wed, May 13, 2015 at 3:00 PM, Alexander Lindsay <[email protected]> wrote: > Hi all, > > I am taking the derivative with respect to a variable, let's call it x, of a > complicated expression, let's call it y. A lot of y' can be rewritten in > terms of y. In a very simple case, y = exp(x) => y' = exp(x) = y > > When I take diff(y,x), obviously I get exp(x) > > Is there a way for me to automatically re-write my answer in terms of y? > Something along the lines of expr.rewrite(func) ? It's trivial to do it > manually in this case, but for more complicated expressions it would be > really neat to be able to automate this > > -- > 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/91481459-5d16-47b6-a819-69c1ed608549%40googlegroups.com. > 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%3D6K2eNXt%3DbrykEYBW%3D47Q1bEFGkx1qc-wEAYjPhQZUpF5g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
