# Weyl algebras

A Weyl algebra is the non-commutative algebra of algebraic differential operators on a polynomial ring. To each variable x corresponds the operator dx that differentiates with respect to that variable. The evident commutation relation takes the form dx*x == x*dx + 1.

We can give any names we like to the variables in a Weyl algebra, provided we specify the correspondence between the variables and the derivatives, with the WeylAlgebra option, as follows.

 i1 : R = QQ[x,y,dx,dy,t,WeylAlgebra => {x=>dx, y=>dy}] o1 = R o1 : PolynomialRing, 2 differential variables i2 : dx*dy*x*y o2 = x*y*dx*dy + x*dx + y*dy + 1 o2 : R i3 : dx*x^5 5 4 o3 = x dx + 5x o3 : R
All modules over Weyl algebras are, in Macaulay2, right modules. This means that multiplication of matrices is from the opposite side:
 i4 : dx*x o4 = x*dx + 1 o4 : R i5 : matrix{{dx}} * matrix{{x}} o5 = | xdx | 1 1 o5 : Matrix R <--- R

All Gröbner basis and related computations work over this ring. For an extensive collection of D-module routines (A D-module is a module over a Weyl algebra), see Dmodules.

The function isWeylAlgebra can be used to determine whether a polynomial ring has been constructed as a Weyl algebra.

 i6 : isWeylAlgebra R o6 = true i7 : S = QQ[x,y] o7 = S o7 : PolynomialRing i8 : isWeylAlgebra S o8 = false