polynomials of derivative operator
Is there any way in Sage to evaluate expressions such as p(x^2d/dx + a + x - x^2y) 1 where p() is a polynomial in one variable? The result would be a polynomial in a,x, and y.
Alternatively, can Sage evaluate (1/f) p(d/dx) f where f is a (non-polynomial) function of x and a and y?
Thanks very much.
I'm trying to understand exactly what you mean. Wouldn't your answer still (possibly) involve d/dx? For instance, wouldn't (d/dx + x^5)^2 = d^2/(d^2 x) + 5x^4 + x^5 d/dx + x^10? Or am I misunderstanding what you mean? Also, I don't understand the purpose of the "1" you put after p(x^2d/dx + a + x - x^2y). (Since you again put a 1 in a similar position in your comment to kcrisman's answer below, I assume it's not a typo.)
Sorry I wasn't clear. Try a simpler example. p is a polynomial in 1 variable. p(d/dx + x^2) is a differential operator. p(d/dx + x^2) 1 is that operator acting on the constant function. The result is a polynomial in x. I'd like to calculate that polynomial in Sage. I have a workaround, using Fourier transforms, that Sage can do via Macsyma, but I suspect an algebraic method would scale better.
Here's an example. Let p(y)=y^2. Then p(d/dx + x^2) = (d/dx)^2 + 2 x^2 d/dx + 2 x + x^4. Acting on 1, this operator gives 2 x + x^4.