On Mon, Apr 16, 2012 at 8:15 AM, Andreas Kloeckner
<[email protected]> wrote:
> On Sun, 15 Apr 2012 19:24:59 -0600, Aaron Meurer <[email protected]> wrote:
>> Just a heads up, you'll need to define the free_symbols in your custom
>> subclass to include whatever you're taking the derivative of, because
>> diff() short-circuits on expressions that don't contain the
>> differentiation variable in the free_symbols.  Hopefully that won't be
>> too much of a burden on this idea.
>
> I've been thinking about this and have mostly convinced myself that I'll
> go the other route instead.
>
> That said, I still do like pymbolic's 'mapper' idea that solves this
> (and more) issues with somewhat greater ease.
>
> - It lets you override per-expr-class behavior of each mapper--be it
>  'differentiate', 'stringify', or something else, without having to
>  rewrite the whole thing.
>
> - It allows a traversal to carry state (the mapper instance).
>
> - A traversal can rebuild the expr tree.
>
> Sympy is either-or on the latter two--a *order_traversal can't rebuild,
> but can easily carry state, while the _eval_*() functions can rebuild,
> but can't carry extra state.
>

Perhaps check out the docstrings of replace and xreplace which can
make replacements during the traversal.

-- 
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.

Reply via email to