WeylAlgebra[{vars,dvars}]
gives the Weyl algebra with variables vars and the corresponding derivatives represented by dvars.
WeylAlgebra[{vars,dvars},alg]
takes the operation names and monomial order settings from the non-commutative algebra alg.
WeylAlgebra
WeylAlgebra[{vars,dvars}]
gives the Weyl algebra with variables vars and the corresponding derivatives represented by dvars.
WeylAlgebra[{vars,dvars},alg]
takes the operation names and monomial order settings from the non-commutative algebra alg.
Details
- WeylAlgebra gives a NonCommutativeAlgebra object representing a Weyl algebra.
- vars and dvars should be lists of equal lengths.
- WeylAlgebra[{{x1,…,xn},{d1,…,dn}}] returns a NonCommutativeAlgebra object representing the Weyl algebra
, which is the unitary algebra given by generators {x1,…,xn,d1,…,dn} and relations
for
, and
,
and
for
. - All elements of the Weyl algebra can be canonically represented as linear combinations of monomials
, where the exponents denote repeated application of the algebra multiplication. NonCommutativeExpand computes the canonical representation of Weyl algebra elements. - alg can be a NonCommutativeAlgebra object or any valid NonCommutativeAlgebra specification.
Examples
open all close allBasic Examples (2)
A Weyl algebra in two variables:
alg = WeylAlgebra[{{x, y}, {dx, dy}}]Compute the canonical form of an element:
NonCommutativeExpand[dy**dx**x**y**x**y, alg]A Weyl algebra with three variables:
alg = WeylAlgebra[{{x, y, z}, {dx, dy, dz}}]Compute the Gröbner basis of a left ideal in the algebra:
NonCommutativeGroebnerBasis[{dx + y**dz, dy - x}, alg, Left]Scope (3)
Specify a nondefault multiplication operation:
alg = WeylAlgebra[{{x, y}, {dx, dy}}, "Multiplication" -> CircleDot]NonCommutativeExpand[dx⊙dy⊙x⊙y, alg]alg = WeylAlgebra[{{x}, {dx}}, "ScalarVariables" -> {a, b}]NonCommutativeExpand[GeneralizedPower[NonCommutativeMultiply, (a x + b dx), 5], alg]Collect terms involving the same powers of
:
alg = WeylAlgebra[{{x, y}, {dx, dy}}]NonCommutativeCollect[dx**x + 2y**dy**x**dx + 3x**dx**dy**x, x, alg]Applications (3)
Compute in the Weyl algebra associated to the differential ring of bivariate polynomials:
wa2 = WeylAlgebra[{{x, y}, {dx, dy}}]Compute the canonical representation of
and
:
f = NonCommutativeExpand[(dx + dy)**x**y, wa2]g = NonCommutativeExpand[dx**(x + y)**(dx - dy), wa2]Compute the canonical representation of
:
h = NonCommutativeExpand[f**g, wa2]Elements of the Weyl algebra correspond to differential operators with product representing composition:
diff[x][p_] := x p
diff[y][p_] := y p
diff[dx][p_] := D[p, x]
diff[dy][p_] := D[p, y]
diff[a_ ? NumericQ][p_] := a p
diff[a_ ? NumericQ f_][p_] := a diff[f][p]
diff[f_Plus][p_] := diff[#][p]& /@ f
diff[f_NonCommutativeMultiply][p_] := (Composition@@(diff /@ f))[p]
diff[GeneralizedPower[NonCommutativeMultiply, f_, k_]][p_] := Nest[diff[f], p, k]Verify that the operator corresponding to
is the composition of the operators corresponding to
and
:
diff[f][diff[g][(2x + 3y) ^ 3]]diff[h][(2x + 3y) ^ 3]Expand[%% - %]Solve an overdetermined system of homogenous linear ODEs with polynomial coefficients:
eqns = {-y[x] - Derivative[1][y][x] - 2 Derivative[2][y][x] + Derivative[3][y][x] - x Derivative[3][y][x] + 3 Derivative[4][y][x] + x Derivative[5][y][x] == 0, 2 x^2 y[x] - 2 x^2 Derivative[2][y][x] - Derivative[3][y][x] + Derivative[5][y][x] == 0, 3 y[x] - 6 Derivative[2][y][x] - x Derivative[3][y][x] + 3 Derivative[4][y][x] + x Derivative[5][y][x] == 0};Convert equations to Weyl algebra elements, with
representing differentiation with respect to
:
toWeyl[a_ == b_] := toWeyl[a - b]
toWeyl[a : (_List | _Plus)] := toWeyl /@ a
toWeyl[c_ ? NumericQ a_] := c toWeyl[a]
toWeyl[a_] := a /. {Derivative[n_][y][x] -> z ^ n, y[x] -> 1} /.
Times -> NonCommutativeMultiply /.
{Power[x, n_.] -> GeneralizedPower[NonCommutativeMultiply, x, n], Power[z, n_.] -> GeneralizedPower[NonCommutativeMultiply, dx, n]}wpolys = toWeyl[eqns]Compute the Gröbner basis of the left ideal generated by the Weyl algebra elements:
wa = WeylAlgebra[{{x}, {dx}}]gb = NonCommutativeGroebnerBasis[wpolys, wa, Left]Find the differential equation corresponding to the Gröbner basis:
toDiff[f_Plus] := toDiff /@ f
toDiff[f_] :=
If[FreeQ[f, dx],
(f /. NonCommutativeMultiply -> Times) y[x],
(f /. NonCommutativeMultiply -> Times) /. Power[dx, n_.] :> D[y[x], {x, n}]]
toEqn[f_List] := toEqn /@ f
toEqn[f_] := toDiff[f] == 0eqn = toEqn[gb]Solve the differential equation:
sol = DSolve[eqn, y, x]Verify that the solution satisfies the original equations:
eqns /. solSolve an overdetermined system of homogenous linear PDEs with polynomial coefficients:
eqns = {u[x, y] + 8 y u[x, y] + 8 x y u[x, y] + u^(0, 1)[x, y] + 2 x u^(0, 1)[x, y] + u^(1, 0)[x, y] + x^2 u^(1, 0)[x, y] + 4 y u^(1, 0)[x, y] + 4 x^2 y u^(1, 0)[x, y] == 0, -3 u^(1, 0)[x, y] - 6 x u^(1, 0)[x, y] + 4 y u^(1, 0)[x, y] + 2 u^(1, 1)[x, y] + 2 x u^(1, 1)[x, y] - 3 u^(2, 0)[x, y] - 3 x^2 u^(2, 0)[x, y] + 4 y u^(2, 0)[x, y] + 2 u^(2, 1)[x, y] + x^2 u^(2, 1)[x, y] == 0, y u[x, y] + 4 x y u[x, y] + u^(0, 1)[x, y] + x u^(0, 1)[x, y] - 3 y u^(1, 0)[x, y] + x^2 y u^(1, 0)[x, y] + x^2 u^(1, 1)[x, y] == 0};Convert equations to Weyl algebra elements, with
representing differentiation with respect to
:
toWeyl[a_ == b_] := toWeyl[a - b]
toWeyl[a : (_List | _Plus)] := toWeyl /@ a
toWeyl[c_ ? NumericQ a_] := c toWeyl[a]
toWeyl[a_] := a /. {Derivative[n_, m_][u][x, y] -> zx ^ n zy ^ m, u[x, y] -> 1} /.
Times -> NonCommutativeMultiply /.
{Power[x, n_.] -> GeneralizedPower[NonCommutativeMultiply, x, n], Power[zx, n_.] -> GeneralizedPower[NonCommutativeMultiply, dx, n], Power[zy, n_.] -> GeneralizedPower[NonCommutativeMultiply, dy, n]}wpolys = toWeyl[eqns]Compute the Gröbner basis of the left ideal generated by the Weyl algebra elements:
wa = WeylAlgebra[{{x, y}, {dx, dy}}]gb = NonCommutativeGroebnerBasis[wpolys, wa, Left]Find the differential equations corresponding to the Gröbner basis:
toDiff[f_Plus] := toDiff /@ f
toDiff[f_] :=
If[FreeQ[f, dx | dy],
(f /. NonCommutativeMultiply -> Times) u[x, y],
(f /. NonCommutativeMultiply -> Times) /. {Power[dx, n_.]Power[dy, m_.] :> D[u[x, y], {x, n}, {y, m}],
Power[dx, n_.] :> D[u[x, y], {x, n}], Power[dy, n_.] :> D[u[x, y], {y, n}]}]
toEqn[f_List] := toEqn /@ f
toEqn[f_] := toDiff[f] == 0eqn = toEqn[gb]Solve the differential equations:
sol = DSolve[eqn, u, {x, y}]Verify that the solution satisfies the original equations:
Simplify[eqns /. sol]Properties & Relations (1)
WeylAlgebra gives a NonCommutativeAlgebra with Weyl algebra structure:
WeylAlgebra[{{x, y}, {dx, dy}}]% === NonCommutativeAlgebra["Structure" -> {"Weyl", {{x, y}, {dx, dy}}}]Related Guides
History
Text
Wolfram Research (2026), WeylAlgebra, Wolfram Language function, https://reference.wolfram.com/language/ref/WeylAlgebra.html.
CMS
Wolfram Language. 2026. "WeylAlgebra." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WeylAlgebra.html.
APA
Wolfram Language. (2026). WeylAlgebra. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WeylAlgebra.html
BibTeX
@misc{reference.wolfram_2026_weylalgebra, author="Wolfram Research", title="{WeylAlgebra}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/WeylAlgebra.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_weylalgebra, organization={Wolfram Research}, title={WeylAlgebra}, year={2026}, url={https://reference.wolfram.com/language/ref/WeylAlgebra.html}, note=[Accessed: 12-June-2026]}