set.seed(0)
knitr::opts_chunk$set(echo = TRUE)
library("weyl")
options("digits" = 5)

![](`r system.file("help/figures/weyl.png", package = "weyl")`){width=10%}

This minimal document creates R objects x and d (available in the weyl package) and gives a couple of use-cases and slick examples. Here, R object x corresponds to the map $f\mapsto xf$ and d corresponds to $\partial$, that is the map $f\mapsto f'=\partial f/\partial x$. Operators are written in prefix notation; for example, $\partial^2x$ is the map $f\mapsto\partial^2xf=(xf)''=(xf'+f)'=xf''+f'+f' =x\partial^2f +2\partial f$. Symbolically we would write this as $\partial^2x=x\partial^2+2\partial$. Package idiom for this would be:

x <- weyl(cbind(1,0))
d <- weyl(cbind(0,1))
options(polyform = TRUE)
x
d

First we verify the fundamental relation $\partial x-x\partial=1$:

d*x-x*d

Now we check the symbolic example given above:

d^2*x

More complicated expressions can be used. Below I evaluate $(1+x)(1-\partial)(1+x+x\partial)^3$:

(1+x)*(1-d)*(1+x+x*d)^3

Multivariate Weyl algebra idiom

We can define generators for the fourth Weyl algebra, that is, generated by $\left\lbrace x_1,x_2,x_3,x_4,\partial_{x_1},\partial_{x_2},\partial_{x_3},\partial_{x_4}\right\rbrace$, together with defining relations $\partial_{x_i}x_i-x_j\partial_{x_j}=\delta_{ij}$:

jj <- diag(8)
x1 <- weyl(jj[1,,drop=FALSE])
x2 <- weyl(jj[2,,drop=FALSE])
x3 <- weyl(jj[3,,drop=FALSE])
x4 <- weyl(jj[4,,drop=FALSE])
d1 <- weyl(jj[5,,drop=FALSE])
d2 <- weyl(jj[6,,drop=FALSE])
d3 <- weyl(jj[7,,drop=FALSE])
d4 <- weyl(jj[8,,drop=FALSE])

Thus, for example,

c(d1*x2-x2*d1 == 0, d3*x3-x3*d3 == 1)

We can use this idiom to do more complicated things:

(d1 + x2 -5*x4)*(d1 + x2 + x3*d4)

Or, using matrix form:

options(polyform=FALSE)
(d1 + x2 -5*x4)*(d1 + x2 + x3*d4)

Package dataset

Following lines create file x_and_d.rda, residing in the data/ directory of the package.

save(x,d,file="x_and_d.rda")


RobinHankin/weyl documentation built on April 14, 2025, 11:49 a.m.