-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
Implement substitution in InfinitePolynomialRing #34581
Comments
New commits:
|
Commit: |
Branch: u/tkarn/inf-poly-subs-34581 |
comment:2
There are some bad behaviors that this implements:
The "standard" thing to do is redirect everything through
Probably the input parsing of |
comment:3
beware of #34542 |
comment:4
This might answer this question from 4 years ago. Thanks! |
comment:6
It looks like |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:9
Green bot :) |
comment:10
LGTM. positive review. Almost unrelated to this ticket, already in the sage: R.<x> = InfinitePolynomialRing(QQ)
sage: S.<z, w> = QQ[]
sage: f = x[1] + x[1]*x[2]*x[3]
sage: f(x_1=w, x_2=z^2+1, x_3=z)
z^3*w + z*w + w But it is a pity we do not have a canonical coercion when substituting only some of the variables: sage: f(x_1=w)
[...]
TypeError: no canonical coercion from Multivariate Polynomial Ring in z, w over Rational Field to Multivariate Polynomial Ring in x_5, x_4, x_3, x_2, x_1, x_0 over Rational Field
During handling of the above exception, another exception occurred:
[...]
TypeError: unsupported operand parent(s) for *: 'Multivariate Polynomial Ring in x_5, x_4, x_3, x_2, x_1, x_0 over Rational Field' and 'Multivariate Polynomial Ring in z, w over Rational Field' |
Reviewer: Tomer Bauer |
comment:11
Thanks! Where should the canonical coercion live? I recall seeing something that there is no coercion between polynomials from say |
Changed reviewer from Tomer Bauer to Tomer Bauer, Travis Scrimshaw |
comment:12
Sorry for not being able to review this sooner. A few things need to be addressed before a positive review from me. Some doc changes: - Substitute variables in an infinite polynomial.
+ Substitute variables in ``self``.
INPUT:
- - ``fixed`` - (optional) dict with variable:value pairs
- - ``**kwargs`` - names parameters
- - ``fixed`` -- (optional) ``dict`` with ``{variable:value}`` pairs
- - ``**kwargs`` -- named parameters
OUTPUT:
- a new polynomial
+
+ the resulting substitution -If you want to substitute variables more generally, use the ``.subs``
-method::
+If you want to substitute variables, you can use the
+standard polynomial methods, such as
+:meth:`~sage.rings.polynomial.infinite_polynomial_element.InfinitePolynomial_sparse.subs`:: This documentation is not quite correct and make this change: - The substitution can also handle matrices. It will
- return a matrix whose entries are polynomials in countably
- many variables::
+ The substitution can also handle matrices:: It is more complicated than that as it does the substitution and then does the addition by coercion. You can check things by looking at the parent of the outputs (or doing additional substitutions). This sentence seems incomplete:
I am not sure I would want to prohibit the mixing of the two types of inputs. I would just do
|
comment:13
Coercion among polynomial rings is notoriously tricky to make consistent (there are some sage-devel threads about this). For example, how do you deal with |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:15
Thanks for the input! |
comment:16
Thank you. One last little thing (an idiosyncrasy most likely), I generally try to avoid referencing Python double-underscore methods. So I would change Passing ``fixed={x[1]: x[0]}``. Note that the keys may be given
- using the ``.__getitem__`` method of the infinite polynomial
- generator ``x_*`` or as a string::
+ using the generators of the infinite polynomial ring
+ or as a string:: After you make this change (or a similar one), you can set a positive review on my behalf if you want. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:18
Replying to Travis Scrimshaw:
Thanks!
|
Changed branch from u/tkarn/inf-poly-subs-34581 to |
Add the ability to substitute variables in
InfinitePolynomialRing
.CC: @tscrim @mwhansen @simon-king-jena
Component: algebra
Keywords: polynomial infinite substitution subs
Author: Trevor K. Karn
Branch/Commit:
a56e345
Reviewer: Tomer Bauer, Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/34581
The text was updated successfully, but these errors were encountered: