Learn R Programming

Weyl algebra in R

To cite the weyl package in publications please use Hankin 2022. The weyl package provides R-centric functionality for working with Weyl algebras of arbitrary dimension. A detailed vignette is provided in the package.

The Weyl algebra is a noncommutative algebra which is used in quantum mechanics and the theory of differential equations (Coutinho 1997). The weyl package offers a consistent and documented suite of R-centric software. It is based on the spray package for sparse arrays for computational efficiency.

The Weyl algebra is arguably the simplest noncommutative algebra and is useful in quantum mechanics. It is isomorphic to the quotient ring of the free algebra on two elements over the ideal generated by . The weyl package implements this and also the -th Weyl algebra.

One usually writes the Weyl algebra in terms of operators where means multiply by and means differentiate with respect to . We find that .

The Weyl algebra is also known as the symplectic Clifford algebra.

Installation

You can install the released version of the weyl package from CRAN with:

# install.packages("weyl")  # uncomment this to install the package
library("weyl")
set.seed(0)

The weyl package in use

The basic creation function is weyl(), which takes a spray object and returns a member of the Weyl algebra.

S <- spray(rbind(c(1,0,0,1,1,0),c(0,1,1,3,2,0)) ,1:2)
S
#>                  val
#>  0 1 1 3 2 0  =    2
#>  1 0 0 1 1 0  =    1

Above, object S is a standard spray object but to work with Weyl algebra we need to coerce it to a weyl object with weyl():

W <- weyl(S)
W
#> A member of the Weyl algebra:
#>   x  y  z dx dy dz     val
#>   0  1  1  3  2  0  =    2
#>   1  0  0  1  1  0  =    1

Above, object W is a member of the third Weyl algebra: that is, the algebra generated by . In this case . In other words .

We might ask what is, and this is easy in the package:

Wsquared <- W*W
Wsquared
#> A member of the Weyl algebra:
#>   x  y  z dx dy dz     val
#>   0  2  2  6  4  0  =    4
#>   0  1  2  6  3  0  =    8
#>   0  1  1  3  3  0  =    6
#>   1  1  1  4  3  0  =    4
#>   2  0  0  2  2  0  =    1
#>   1  0  1  4  2  0  =    2
#>   1  0  0  1  2  0  =    1

This is a more complicated operator. However, we might wish to display it in symbolic form:

options(polyform=TRUE)
Wsquared
#> A member of the Weyl algebra:
#> +4*y^2*z^2*dx^6*dy^4 +8*y*z^2*dx^6*dy^3 +6*y*z*dx^3*dy^3
#> +4*x*y*z*dx^4*dy^3 +x^2*dx^2*dy^2 +2*x*z*dx^4*dy^2 +x*dx*dy^2

References

Further information

For more detail, see the package vignette

vignette("weyl")

Copy Link

Version

Install

install.packages('weyl')

Monthly Downloads

364

Version

0.0-7

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Robin K S Hankin

Last Published

April 8th, 2025

Functions in weyl (0.0-7)

spray

Create spray objects
print.weyl

Print methods for weyl objects
identity

The identity operator
weyl

The algebra and weyl objects
ooom

One over one minus
rweyl

Random weyl objects
constant

The constant term
horner

Horner's method
Ops

Arithmetic Ops Group Methods for the Weyl algebra
derivation

Derivations
dim

The dimension of a weyl object
grade

The grade of a weyl object
dot-class

Class “dot”
degree

The degree of a weyl object
coeffs

Manipulate the coefficients of a weyl object
drop

Drop redundant information
weyl-class

Class “weyl”
weyl-package

tools:::Rd_package_title("weyl")
x_and_d

Generating elements for the first Weyl algebra
zero

The zero operator