Opened 19 months ago
Last modified 4 months ago
#31198 new defect
Add dict method for boolean polynomials
Reported by: | slelievre | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.7 |
Component: | commutative algebra | Keywords: | |
Cc: | slelievre | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
Boolean polynomials lack a dict
method
available for other polynomials.
This prevents expressing a multivariate polynomial as a polynomial in one if its variables.
Define a boolean polynomial:
sage: P = BooleanPolynomialRing(8, 'x') sage: x = P.gens() sage: p = x[1] * x[2] + x[1] * x[3] * x[5] + x[3] + x[7] * x[2] sage: p x1*x2 + x1*x3*x5 + x2*x7 + x3
Before this ticket:
sage: p.dict() Traceback (most recent call last) ... AttributeError: 'sage.rings.polynomial.pbori.pbori.BooleanPolynomial' object has no attribute 'dict' sage: p.polynomial(x[1]) Traceback (most recent call last) ... AttributeError: 'sage.rings.polynomial.pbori.pbori.BooleanPolynomial' object has no attribute 'dict'
Compare with polynomials over ZZ
:
sage: P = PolynomialRing(ZZ, 8, 'x') sage: x = P.gens() sage: p = x[1] * x[2] + x[1] * x[3] * x[5] + x[3] + x[7] * x[2] sage: p.dict() {(0, 1, 0, 1, 0, 1, 0, 0): 1, (0, 1, 1, 0, 0, 0, 0, 0): 1, (0, 0, 1, 0, 0, 0, 0, 1): 1, (0, 0, 0, 1, 0, 0, 0, 0): 1} sage: p.polynomial(x[1]) (x3*x5 + x2)*x1 + x2*x7 + x3
Initial report:
Change History (5)
comment:1 Changed 19 months ago by
- Description modified (diff)
comment:2 Changed 18 months ago by
- Milestone changed from sage-9.3 to sage-9.4
Setting new milestone based on a cursory review of ticket status, priority, and last modification date.
comment:3 Changed 13 months ago by
- Milestone changed from sage-9.4 to sage-9.5
comment:4 Changed 8 months ago by
- Milestone changed from sage-9.5 to sage-9.6
comment:5 Changed 4 months ago by
- Milestone changed from sage-9.6 to sage-9.7
Note: See
TracTickets for help on using
tickets.
Boolean polynomials also lack floor division and mod.
Define
Then:
But in fact
/
performs floor division: