SymPy does not yet have a derivative operator object (see
http://code.google.com/p/sympy/issues/detail?id=1620) and classes like
Lambda only work on arguments of functions, not functions (i.e., something
like Lambda(f(x), f) does not work).

So I think the only way to do this right now is to create the expression
with a dummy function (and unfortunately, we don't even have a
DummyFunction class!) and the replace it with subs.

We definitely need more support for operators in the core of SymPy. I can
point you to some issues and discussions if you are interested in improving
the situation.

Aaron Meurer

On Aug 18, 2012, at 4:10 PM, Guru Devanla <[email protected]> wrote:

I am doing some exercises, and wanted to see how I could represent this
expression using Sympy.

Say  A = d/dx and B = x.

I need to evaluate [A,B].

Manually, this is what I do: say, I have some function f, this commutator
acts on, then I have

[A,B] f =  (AB - BA)(f) =   (d/dx)(x)(f) - x(d/dx)(f)
           =  x * (df/dx) + f - x * (df/dx) =  f.

How can I represent such an expression in Sympy, and also get f as the
answer if I use .doit() to expand the expression.

I am documenting some of the use cases I have been playing with, so that I
can consolidate and publish these exercises as a notebook document.

Thanks
-Guru

-- 
You received this message because you are subscribed to the Google Groups
"sympy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sympy/-/02WXqQX7VCkJ.
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.

Reply via email to