Ask Your Question
1

polynomials of derivative operator

asked 2012-04-04 23:32:12 +0100

Daniel Friedan gravatar image

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.

edit retag flag offensive close merge delete

Comments

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.)

jdc gravatar imagejdc ( 2012-04-06 10:21:58 +0100 )edit

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.

Daniel Friedan gravatar imageDaniel Friedan ( 2012-04-06 15:56:47 +0100 )edit

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.

Daniel Friedan gravatar imageDaniel Friedan ( 2012-04-06 16:06:59 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-04-05 12:49:04 +0100

kcrisman gravatar image

updated 2012-04-06 11:35:50 +0100

sage: var('a y')
(a, y)
sage: F = function('F',x)
sage: G = F.derivative(x)
sage: G
D[0](F)(x)
sage: exp = x^2*G + a + x - x^2*y
sage: p(h) = h^2-h+1
sage: p(exp)
x^2*y - x^2*D[0](F)(x) + (x^2*y - x^2*D[0](F)(x) - a - x)^2 - a - x + 1
sage: p(exp).expand()
x^4*y^2 - 2*x^4*y*D[0](F)(x) + x^4*D[0](F)(x)^2 - 2*a*x^2*y + 2*a*x^2*D[0](F)(x) - 2*x^3*y + 2*x^3*D[0](F)(x) + x^2*y - x^2*D[0](F)(x) + a^2 + 2*a*x + x^2 - a - x + 1

Downside: these aren't really differential operators or D-module thingies, just derivatives of a dummy function. There is this functionality, but:

sage: from sage.tensor.differential_form_element import d
sage: exp1 = x^2*d + a + x - x^2*y
TypeError: unsupported operand parent(s) for '*': 'Symbolic Ring' and '<type 'function'>'

so I don't think it's immediately usable. See also this Trac ticket about implementing more general pseudo-differential operators.

edit flag offensive delete link more

Comments

Thanks, but I don't think your proposed answer does what I asked. Here's a simpler version: (d/dx + a x)^2 1 = a + a^2 x^2 Your code sage: var('a y') (a, y) sage: F = function('F',x) sage: G = F.derivative(x) sage: G D[0](F)(x) sage: exp = G + a*x sage: p(h) = h^2 sage: p(exp) (a*x + D[0](F)(x))^2

Daniel Friedan gravatar imageDaniel Friedan ( 2012-04-05 13:27:24 +0100 )edit

I guess I'm confused - what about this is not a polynomial in one variable? (Other than the dummy issue, of course.) I'm editing my answer with what you (perhaps?) mean...

kcrisman gravatar imagekcrisman ( 2012-04-06 11:35:38 +0100 )edit

please see my comment in response to jdc above

Daniel Friedan gravatar imageDaniel Friedan ( 2012-04-06 15:57:36 +0100 )edit

Okay, so what you really want are not just polynomials with a given dummy `Df`, but honest-to-goodness differential operators that take functions as input. Apparently even Maxima doesn't quite have this, though the `pdiff` package seems to be pretty close, which you can search their docs for (and then use within/in conjunction with Sage...)

kcrisman gravatar imagekcrisman ( 2012-04-10 15:42:46 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-04-04 23:32:12 +0100

Seen: 1,312 times

Last updated: Apr 06 '12