#10317 closed defect (wontfix)
how to copy/paste InfinitePolynomialRings?
Reported by: | Paul Zimmermann | Owned by: | Alex Ghitza |
---|---|---|---|
Priority: | minor | Milestone: | sage-duplicate/invalid/wontfix |
Component: | basic arithmetic | Keywords: | |
Cc: | Mike Hansen, Simon King, Jeroen Demeyer | Merged in: | |
Authors: | Reviewers: | Simon King | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
when one creates an object with InfinitePolynomialRing
:
sage: R.<a> = InfinitePolynomialRing(ZZ) sage: f = a[0]+a[1]+a[2]
the variables are printed a_i
instead of a[i]
:
sage: f a_2 + a_1 + a_0
and one cannot copy/paste the result of a computation:
sage: a_2 + a_1 + a_0 --------------------------------------------------------------------------- NameError Traceback (most recent call last) /users/caramel/zimmerma/try/<ipython console> in <module>() NameError: name 'a_2' is not defined
Is there a workaround?
Change History (12)
comment:1 follow-up: 2 Changed 12 years ago by
Cc: | Mike Hansen Simon King added |
---|---|
Component: | calculus → basic arithmetic |
Owner: | changed from Burcin Erocal to Alex Ghitza |
comment:2 follow-ups: 3 5 Changed 12 years ago by
Replying to kcrisman:
contrary to your example, the problem is that you can't even copy/paste a_2 + a_1 + a_0
without defining at hand the corresponding variables, which then questions the usefulness of
InfinitePolynomialRings
...
Paul
comment:3 Changed 12 years ago by
contrary to your example, the problem is that you can't even copy/paste
a_2 + a_1 + a_0
without defining at hand the corresponding variables, which then questions the usefulness ofInfinitePolynomialRings
...
Perhaps, but I'll leave answering that to the people who wrote it. Presumably one uses it only in the form of putting f
in some other computation, leaving the printed output just for viewing, not for computation.
I'm just pointing out that there are other times where pasting the output of a command does not give the same thing as the output, and that it can't always be treated as a bug. Matrices are another example where the string representation is not 'useful' in that way. Whether it raises an error or not would depend on the context. At the same time, I agree that it would be annoying in the context of (say) a finite polynomial ring, or the Symbolic 'ring'.
comment:4 Changed 12 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
- I see no reason whatsoever to expect that the string representation of any object should return the object by copy-and-paste. Just think of any element of a finite prime field: Its string representation will yield an integer by copy-and-paste - not a prime field element. Or just think of
ZZ
: Try to copy-and-paste its string representation...
This is why I resolve the ticket as wontfix.
- There are two or three reasons why I decided to represent the elements of an infinite polynomial ring the way they are.
(i) In the literature, the notation for the indices of variables is by subscript. Hence, Latex style,
_
.
(ii) The arithmetic and, in particular, the Gröbner machinery, is based on finite polynomial rings. It is reasonable to have the same variable names both for the finite and the infinite polynomial ring. But
x[3]
is no valid variable name of a finite polynomial ring.
(ii+1/2) I find
x_1
nicer to read thanx[1]
.
- Here is your workaround:
sage: R.<a> = InfinitePolynomialRing(ZZ) sage: f = a[0]+a[1]+a[2] sage: f a_2 + a_1 + a_0 sage: R('a_2 + a_1 + a_0') a_2 + a_1 + a_0 sage: R('a_2 + a_1 + a_0')==f True
comment:5 Changed 12 years ago by
Replying to zimmerma:
Replying to kcrisman:
contrary to your example, the problem is that you can't even copy/paste
a_2 + a_1 + a_0
without defining at hand the corresponding variables, which then questions the usefulness ofInfinitePolynomialRings
...
The purpose of InfinitePolynomialRing
is certainly not to insert infinitely many identifiers into the global name space.
Its main purpose is not even to have a convenient way to create a countable set of variables and do arithmetic with it.
The main purpose is described in the documentation: Do computations related with finitely generated ideals in countably infinitely many variables that are set-wise invariant under permutation of the variables (ideal containment, etc). The background is the theory of symmetric Gröbner bases due to Aschenbrenner and Hillar.
comment:6 follow-up: 7 Changed 12 years ago by
Cc: | Jeroen Demeyer added |
---|
I think in general the release manager likes to do the official closing. I'm cc:ing him, though, so that this gets recorded; there shouldn't be any objection to this. Nice workaround, by the way - that is extremely natural.
comment:7 follow-up: 9 Changed 12 years ago by
Replying to kcrisman:
I think in general the release manager likes to do the official closing.
Oops, sorry!
I think there really should be the possibility to just mark a ticket as "invalid" or "wontfix" or "duplicate", without actually closing it. I mean, what else should I have done? Change it to "positive review"???
comment:8 Changed 12 years ago by
Milestone: | sage-4.7 → sage-duplicate/invalid/wontfix |
---|
comment:9 Changed 12 years ago by
Replying to SimonKing:
I mean, what else should I have done? Change it to "positive review"???
Yes please.
comment:10 follow-up: 11 Changed 12 years ago by
To clarfiy: if you put a ticket to positive review with a milestone of sage-duplicate/invalid/wontfix, it will show up in Tickets with positive review and I will see that it needs to be closed.
comment:11 Changed 12 years ago by
Replying to jdemeyer:
To clarfiy: if you put a ticket to positive review with a milestone of sage-duplicate/invalid/wontfix, it will show up in Tickets with positive review and I will see that it needs to be closed.
Thank you, that makes sense. I wasn't aware that duplicate etc. exists as milestone. Should I do so with this particular ticket as well, or shall I leave it closed now?
comment:12 Changed 12 years ago by
Reviewers: | → Simon King |
---|
Now just leave it as it is.
I am also adding your name as Reviewer with the meaning of "it was Simon King who 'reviewed' the fact that this ticket should be closed".
I don't know that there is.
has some very extensive documentation that clearly states what the representations are.
This isn't the only place this happens in Sage:
Ordinarily I would be more eager to try to resolve such conflicts, but anyone using an infinite polynomial ring probably knows what they are doing.
I would just assign the result of the computation to a variable. Otherwise I don't see much happening here. I'm cc:ing the authors of this file in just to be sure, but probably this should be closed as 'wontfix'.
Also changing component, though 'rings' would be nice to have there as an option...