A differential operator of the ring $R = \mathbb{K}[x_1,\dots,x_n]$ can be thought of as a polynomial with coefficients in $R$, and monomials in variables $dx_1, \dots, dx_n$, where $dx_i$ corresponds to the partial derivative with respect to $x_i$. These operators form an $R$-vector space, and act naturally on elements of $R$.
i1 : R = QQ[x,y] o1 = R o1 : PolynomialRing |
i2 : D = diffOp {x => x+y, x*y^2 => 3+x} 2 o2 = (x + 3)dx*dy + (x + y)dx o2 : DiffOp |
i3 : (x^2+3) * D 3 2 2 3 2 o3 = (x + 3x + 3x + 9)dx*dy + (x + x y + 3x + 3y)dx o3 : DiffOp |
i4 : D + D 2 o4 = (2x + 6)dx*dy + (2x + 2y)dx o4 : DiffOp |
i5 : D(x^5*y^2) 5 2 4 3 5 4 o5 = 5x y + 5x y + 10x + 30x o5 : R |
Instances of DiffOp are hash tables, where keys are differential monomials (represented as monomials in $R$), and values are the corresponding coefficients. A useful shortcut for creating instances of DiffOp is to use a WeylAlgebra.
i6 : needsPackage "Dmodules" o6 = Dmodules o6 : Package |
i7 : S = makeWA R o7 = S o7 : PolynomialRing, 2 differential variables |
i8 : E = diffOp(y*dx - x*dy^2) 2 o8 = - x*dy + y*dx o8 : DiffOp |