Ticket #13104 (closed defect: fixed)

Opened 11 months ago

Last modified 11 months ago

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

pbori_variables.patch Download (827 bytes) - added by Bouillaguet 11 months ago.
patch that fixes the problem

Change History

Changed 11 months ago by Bouillaguet

patch that fixes the problem

comment:1 Changed 11 months ago by Bouillaguet

  • Status changed from new to needs_review

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:4 Changed 11 months ago by malb

Sorry, my bad!

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.

comment:6 Changed 11 months ago by malb

  • Status changed from needs_review to positive_review
  • Reviewers set to Alexander Dreyer, Martin Albrecht
  • Authors set to Charles Bouillaguet

comment:7 Changed 11 months ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-5.1.beta6
Note: See TracTickets for help on using tickets.