Ticket #13104 (closed defect: fixed)
BooleanPolynomial.variables() consider "1" as a variable
| Reported by: | Bouillaguet | Owned by: | malb |
|---|---|---|---|
| Priority: | trivial | Milestone: | sage-5.1 |
| Component: | commutative algebra | Keywords: | BooleanPolynomial |
| Cc: | malb, AlexanderDreyer, PolyBoRi | Work issues: | |
| Report Upstream: | N/A | Reviewers: | Alexander Dreyer, Martin Albrecht |
| Authors: | Charles Bouillaguet | Merged in: | sage-5.1.beta6 |
| Dependencies: | Stopgaps: |
Description
This is in contradiction with other functions (BooleanPolynomial?.nvariables), and with the behavior of the "normal" class MPolynomial.
Example:
sage: R.<x,y,z> = BooleanPolynomialRing() sage: p = R(1) sage: p.variables() (1,) sage: p.nvariables() 0
Which differs from:
sage: R.<x,y,z> = GF(2)[] sage: p = R(1) sage: p.variables() () sage: p.nvariables() 0
Attachments
Change History
Changed 11 months ago by Bouillaguet
-
attachment
pbori_variables.patch
added
comment:2 Changed 11 months ago by malb
- Cc AlexanderDreyer, PolyBoRi added
Hi, can you add a doctest that shows that the issue is resolved? I also CCed the PolyBoRi? developers to make sure there isn't some obscure reason for this behaviour.
comment:3 Changed 11 months ago by Bouillaguet
Hi,
I actually did, in fact. I modified the existing docstring to verify that:
sage: P.one_element().variables() ()
Should I add anything else?
comment:5 Changed 11 months ago by AlexanderDreyer
p.variables() is a Sage extension (see #1715), the corresponding p.vars_as_monomial() () already behaves like this. (I think in early versions of PolyBoRi p.vars_as_monomial() could become 0, but this was a design error.) So I can clearly give a positive review.

patch that fixes the problem