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.

Reply via email to