TITLE: How big can a commutative subalgebra of Weyl algebra be?
QUESTION [7 upvotes]: Consider the smallest Weyl algebra $A_1=\{q,p; qp-pq=1\}$. It is known that there exist pairs of commuting elements, say $L$ and $M$, that obey various polynomial relations, e.g. elliptic curves. I wonder how big the commutative subalgebra of the Weyl algebra can be? (of course, I mean how big the generating set of commuting elements can be since any product of commuting things trivially commutes with the generating set)

REPLY [4 votes]: A maximal commutative subalgebra of the Weyl algebra can have arbitrarily many generators. (Though, as explained in my other answer, it must be finitely generated.) Let the Weyl algebra as $k\langle x,y \rangle / yx-xy-1$ (where $k$ is a field of characteristic zero) and define $z = xy$. Let $a$ be a rational non-integer. Set
$$\theta = \frac{\prod_{i=1}^{n} (z-a+i)(z-a-i)}{(z-a)^n} x,$$
I will discuss below how to make sense of the division. Then I claim that $$k[\theta] \cap A_1 = k[\theta^{n+1}, \theta^{n+2}, \theta^{n+3}, \ldots],$$
and that this is a maximal commutative subalgebra of $A_1$. This ring cannot be generated by fewer then $n+1$ generators. This example (slightly modified) for $n=1$ appears in Mikar-Limanov's paper, where he credits it to "someone in Moscow, Russia about 1968".  
Thanks for making me finally figure out why this example works!

We begin with the equations 
$$zx = x(z+1) \quad zy=y(z-1)$$
which may be checked directly. These maybe seen to imply
$$f(z) x = x f(z+1) \quad f(z) y = y f(z-1)$$
for any polynomial $f$. Let $B$ be the ring generated by $k(z)$, $x$ and $y$, with relations
$$f(z) x = x f(z+1) \quad f(z) y = y f(z-1) \quad xy=z \quad yx= z+1$$
for any rational function $f(z) \in k(z)$. So the Weyl algebra $A$ maps to $B$ and, using that $A$ is a domain, this can be seen to be an embedding. Note that, in $B$, we have $x^{-1} = (z+1)^{-1} y$ or, equivalently, $y = (z+1) x^{-1}$. So we can equally well describe $B$ as the ring generated by $k(z)$ and $x^{\pm 1}$, subject to the relation $zx=x(z+1)$.
Every element of the ring $B$ can be uniquely written as
$$\sum_{n=-\infty}^{\infty} f_n(z) x^n$$
with the $f_n(z)$ in $k(z)$ and all but finitely many $f_n$ equal to zero. Multiplication is given by
$$\left( \sum_m f_m(z) x^m \right) \left( \sum_n g_n(z) x^n \right) = \sum_{m,n} f_m(z) g_n(z-m) x^{m+n}$$
Define 
$$ f^{(n)}(z) =
\begin{cases} f(z) f(z-1) f(z-2) \cdots f(z-n+1) & n > 0 \\
1 & n=1 \\
\frac{1}{f(z+1)f(z+2) \cdots f(z+(-n))} & n < 0 \\
\end{cases}$$
An easy induction establishes 
$$\left( f(z) x \right)^n = f^{(n)}(z) x^n$$
Lemma Let $\theta = f(z) x$ for some nonzero rational function $f(z)$. Then $\sum a_n(z) x^n$ commutes with $\theta$ if and only if $a_n$ is a scalar multiple of $f^{(n)}$ for all $n$. In other words, the elements of $B$ which commute with $\theta$ are all of the form $\sum c_n \theta^n$ for $c_n \in k$.
Proof Write $a_n(z)$. Comparing the coefficient of $x^{n+1}$ on both sides of $ \left( \sum a_n(z) x^n \right) \theta = \theta \left( \sum a_n(z) x^n \right)$ gives
$$a_n(z) f(z-n) = f(z) a_n(z-1).$$
Writing $a_n(z) = f^{(n)}(z) b_n(z)$, we deduce that
$$b_n(z) = b_n(z-1).$$
The only periodic rational functions are the constants. $\square$.
Set $f(z) = \prod_{i=1}^n (z-a+i)(z-a-i)/(z-a)^n$. I leave the following to you:
Lemma For $m>n$, the rational function $f^{(m)}(z)$ is in $k[z]$. For $m$ nonzero and $\leq n$, the rational function $f^{(m)}(z)$ has a pole at a noninteger.
Corollary  The elements of $A_1$ which commute with $\theta$ are of the form $c_0 + \sum_{m >n } c_m \theta^m$.
The only detail to keep track of is the conversion from $x^{-m}$ to $\frac{1}{(z+1)(z+2) \cdots (z+m) } y^m$; this is why I made $a$ a noninteger.

Having checked all this, I claim that $R=k[\theta^{n+1} , \theta^{n+2}, \cdots, ]$ is a maximal commutative subring of $A_1$. We showed above that it is contained in $A_1$. And, if $\alpha$ commutes with $\theta^{n+1}$ and $\theta^{n+2}$, then $\alpha$ commutes with $\theta$. So any element of $A_1$ which commutes with $R$ is itself in $R$. This shows that $R$ is maximal.