-
-
Notifications
You must be signed in to change notification settings - Fork 648
Add an infinite weyl algebra class #40263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Planarity4
Documentation preview for this PR (built with commit 5f260c8; changes) is ready! 🎉 |
src/sage/algebras/weyl_algebra.py
Outdated
elif isinstance(R, InfinitePolynomialRing_dense): | ||
return InfiniteDifferentialWeylAlgebra(R, names) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif isinstance(R, InfinitePolynomialRing_dense): | |
return InfiniteDifferentialWeylAlgebra(R, names) | |
elif isinstance(R, InfinitePolynomialRing_dense) and names is None: | |
return InfiniteDifferentialWeylAlgebra(R.base_ring(), R.variable_names()) |
What if the base ring for a finitely generated Weyl algebra is an infinite polynomial ring? (Add a test checking this works as expected.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to work as expected (added some tests to make sure both infinite over finite and finite over infinite work as expected.
One issue I noticed is that the InfinitePolynomialRing class collapses things down, so it would be tricky to define an infinite weyl algebra over and infinite polynomial ring. For instance, here it forgets that R
is the base ring.
sage: R.<x> = InfinitePolynomialRing(QQ)
sage: R2.<y> = InfinitePolynomialRing(R)
sage: R2.base_ring()
Rational Field
src/sage/algebras/weyl_algebra.py
Outdated
if isinstance(R, InfinitePolynomialRing_dense): | ||
names = R.variable_names() | ||
if len(names) > 1: | ||
raise NotImplementedError("only one set of variables supported") | ||
R = R.base_ring() | ||
elif names is None: | ||
names = ('x',) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if isinstance(R, InfinitePolynomialRing_dense): | |
names = R.variable_names() | |
if len(names) > 1: | |
raise NotImplementedError("only one set of variables supported") | |
R = R.base_ring() | |
elif names is None: | |
names = ('x',) | |
if isinstance(R, InfinitePolynomialRing_dense) and names is None: | |
names = R.variable_names() | |
if len(names) > 1: | |
raise NotImplementedError("only one set of variables supported") | |
R = R.base_ring() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing this causes an error when you construct via
sage: W = DifferentialWeylAlgebra(QQ, n=oo)
I moved the check to the differential weyl classcall to handle this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some little details.
src/sage/algebras/weyl_algebra.py
Outdated
""" | ||
An element of an infinitely generated differential Weyl algebra. | ||
|
||
TESTS:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TESTS:: | |
EXAMPLES:: |
src/sage/algebras/weyl_algebra.py
Outdated
for _ in range(p): | ||
next = [] | ||
for m, c in cur: | ||
diff = dict(m[1].dict()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff = dict(m[1].dict()) | |
diff = m[1].dict() |
The extra dict
call should not be necessary.
src/sage/algebras/weyl_algebra.py
Outdated
We can construct an Infinite Weyl algebra by using the ``n=oo`` parameter in | ||
the constructor for DifferentialWeylAlgebra:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can construct an Infinite Weyl algebra by using the ``n=oo`` parameter in | |
the constructor for DifferentialWeylAlgebra:: | |
We construct an infinite Weyl algebra by using the ``n=oo`` in | |
:class:`DifferentialWeylAlgebra`:: |
src/sage/algebras/weyl_algebra.py
Outdated
Due to a bug in ``InfinitePolynomialRing`` (see :issue:`36788`) trying to define the infinite Weyl | ||
algebra of an infinite polynomial ring with coefficients in another infinite | ||
polynomial ring will result in unexpected behavior:: | ||
|
||
sage: R.<x> = InfinitePolynomialRing(QQ) | ||
sage: R2.<y> = InfinitePolynomialRing(R) | ||
sage: W = DifferentialWeylAlgebra(R2); W # known bug | ||
Differential Weyl algebra in countably many variables z over Infinite | ||
polynomial ring in x over Rational Field | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to a bug in ``InfinitePolynomialRing`` (see :issue:`36788`) trying to define the infinite Weyl | |
algebra of an infinite polynomial ring with coefficients in another infinite | |
polynomial ring will result in unexpected behavior:: | |
sage: R.<x> = InfinitePolynomialRing(QQ) | |
sage: R2.<y> = InfinitePolynomialRing(R) | |
sage: W = DifferentialWeylAlgebra(R2); W # known bug | |
Differential Weyl algebra in countably many variables z over Infinite | |
polynomial ring in x over Rational Field | |
Due to a bug in ``InfinitePolynomialRing`` (:issue:`36788`) trying to define the infinite Weyl | |
algebra of an infinite polynomial ring with coefficients in another infinite | |
polynomial ring will result in unexpected behavior:: | |
sage: R.<x> = InfinitePolynomialRing(QQ) | |
sage: R2.<y> = InfinitePolynomialRing(R) | |
sage: W = DifferentialWeylAlgebra(R2); W # known bug | |
Differential Weyl algebra in countably many variables z over Infinite | |
polynomial ring in x over Rational Field | |
src/sage/algebras/weyl_algebra.py
Outdated
sage: W = DifferentialWeylAlgebra(R); W | ||
Differential Weyl algebra in countably many variables x over Rational Field | ||
|
||
.. WARNING: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. WARNING: | |
.. WARNING:: |
src/sage/algebras/weyl_algebra.py
Outdated
|
||
OUTPUT: A nonnegative integer | ||
|
||
EXAMPLE:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXAMPLE:: | |
EXAMPLES:: |
We generally make it plural, even if there is only 1 test/example.
should be good to go now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get this in. Positive review.
sagemathgh-40263: Add an infinite weyl algebra class <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> This PR adds a class ``InfiniteDifferentialWeylAlgebra``, the infinite analog of the currently existing ``DifferentialWeylAlgebra`` class. It is an algebra generated by two countable families of symbols x_i, dx_i subject to the relations [x_i, x_j] = [dx_i, dx_j] = 0 and [x_i, dx_j] = \delta_{i, j} Part of sagemath#40241 cc: @tscrim ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#40263 Reported by: Joe McDonough Reviewer(s): Joe McDonough, Travis Scrimshaw
Fails with the same error as the CI |
@vbraun I'm a bit confused by the cause of this error. Somehow importing Also cc'ing @tscrim in case he needs to re positive review the PR. edit: it seems like one of the CI tests is now failing on a doctest for singular, but I'm not sure how to go about diagnosing why. |
Now it is passing all of the builds. |
This PR adds a class
InfiniteDifferentialWeylAlgebra
, the infinite analog of the currently existingDifferentialWeylAlgebra
class. It is an algebra generated by two countable families of symbols x_i, dx_i subject to the relations [x_i, x_j] = [dx_i, dx_j] = 0 and [x_i, dx_j] = \delta_{i, j}Part of #40241
cc: @tscrim
📝 Checklist
⌛ Dependencies