Let $P_x = \frac{\hbar}{i}\frac{d}{dx}$, after specifying the commutator relation symbolically $[X, P_x] = i\hbar$, I can ask Mathematica to calculate commutator algebra. My question: is there a way for Mathematica to directly calculate this commutator without me specifying it? I've tried after searching and reading pure functions
x*(D[#, x] &) - (D[#, x] &)*x
but it doesn't quite compute correctly.
Out[420]= -1`
– Daniel Lichtblau Jan 11 '19 at 18:38