This is essentially a follow-up to the question/answer here: How to define a differential operator?
Suppose I wish to define an operator
but in such a way that the function can read in the argument without having to state it explicitly. Can this be done? If so, how?
In code, what I'd like (using the example above) is a definition that would give
DiffOp[f[x]] (* f'[x]+4x f''[x] *)
DiffOp[x^2+Sin[x]] (* 10x+Cos[x]-4x Sin[x] *)
Note that I'm not explicitly calling the function as
Edit: I changed the example expression to be more complicated to test.