Skip to content

Commit

Permalink
Fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
user202729 committed Feb 1, 2025
1 parent ef6e60f commit e4aba06
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/sage/doctest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def reproducible_repr(val):
frozenset(['a', 'b', 'c', 'd'])
sage: print(reproducible_repr([1, frozenset("cab"), set("bar"), 0]))
[1, frozenset(['a', 'b', 'c']), set(['a', 'b', 'r']), 0]
sage: print(reproducible_repr({3.0: "three", "2": "two", 1: "one"})) # optional - sage.rings.real_mpfr
sage: print(reproducible_repr({3.0: "three", "2": "two", 1: "one"})) # needs sage.rings.real_mpfr
{'2': 'two', 1: 'one', 3.00000000000000: 'three'}
sage: print(reproducible_repr("foo\nbar")) # demonstrate default case
'foo\nbar'
Expand Down
18 changes: 15 additions & 3 deletions src/sage/rings/polynomial/multi_polynomial_ideal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5501,9 +5501,21 @@ def weil_restriction(self):
z0, z1, z2, z3, z4 over Finite Field of size 3
sage: J += sage.rings.ideal.FieldIdeal(J.ring()) # ensure radical ideal
sage: J.variety()
[{x0: 1, x1: 0, x2: 0, x3: 0, x4: 0,
y0: 0, y1: 0, y2: 0, y3: 0, y4: 0,
z0: 0, z1: 0, z2: 0, z3: 0, z4: 0}]
[{z4: 0,
z3: 0,
z2: 0,
z1: 0,
z0: 0,
y4: 0,
y3: 0,
y2: 0,
y1: 0,
y0: 0,
x4: 0,
x3: 0,
x2: 0,
x1: 0,
x0: 1}]
Weil restrictions are often used to study elliptic curves over
Expand Down
8 changes: 4 additions & 4 deletions src/sage/rings/polynomial/multi_polynomial_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
pair and study it::
sage: set_random_seed(1)
sage: while True: # workaround (see :issue:`31891`) # needs sage.rings.polynomial.pbori
sage: while True: # workaround (see :issue:`31891`) # needs sage.rings.polynomial.pbori
....: try:
....: F, s = sr.polynomial_system()
....: break
Expand Down Expand Up @@ -122,7 +122,7 @@
easily::
sage: sr = mq.SR(1,1,1,4, gf2=True, polybori=True, order='lex') # needs sage.rings.polynomial.pbori
sage: while True: # workaround (see :issue:`31891`) # needs sage.rings.polynomial.pbori
sage: while True: # workaround (see :issue:`31891`) # needs sage.rings.polynomial.pbori
....: try:
....: F, s = sr.polynomial_system()
....: break
Expand Down Expand Up @@ -1556,7 +1556,7 @@ def solve(self, algorithm='polybori', n=1,
sage: S = Sequence([x*y + z, y*z + x, x + y + z + 1])
sage: sol = S.solve()
sage: sol
[{x: 0, y: 1, z: 0}]
[{z: 0, y: 1, x: 0}]
We check that it is actually a solution::
Expand All @@ -1567,7 +1567,7 @@ def solve(self, algorithm='polybori', n=1,
sage: sols = S.solve(n=Infinity) # needs sage.rings.polynomial.pbori
sage: sols # needs sage.rings.polynomial.pbori
[{x: 0, y: 1, z: 0}, {x: 1, y: 1, z: 1}]
[{z: 0, y: 1, x: 0}, {z: 1, y: 1, x: 1}]
sage: [S.subs(x) for x in sols] # needs sage.rings.polynomial.pbori
[[0, 0, 0], [0, 0, 0]]
Expand Down
8 changes: 5 additions & 3 deletions src/sage/rings/polynomial/pbori/pbori.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5034,7 +5034,7 @@ class BooleanPolynomialIdeal(MPolynomialIdeal):
sage: R.<x,y,z> = BooleanPolynomialRing()
sage: I = ideal( [ x*y*z + x*z + y + 1, x+y+z+1 ] )
sage: I.variety()
[{x: 0, y: 1, z: 0}, {x: 1, y: 1, z: 1}]
[{z: 0, y: 1, x: 0}, {z: 1, y: 1, x: 1}]
TESTS:
Expand All @@ -5052,13 +5052,15 @@ class BooleanPolynomialIdeal(MPolynomialIdeal):
....: x1*x2 + x1*x6 + x2*x4 + x2*x5 + x2*x6 + x3*x6 + x4*x6 + x5*x6 + x5]
sage: I = R.ideal( polys )
sage: I.variety()
[{x1: 0, x2: 0, x3: 0, x4: 0, x5: 0, x6: 0}, {x1: 1, x2: 1, x3: 1, x4: 0, x5: 0, x6: 1}]
[{x6: 0, x5: 0, x4: 0, x3: 0, x2: 0, x1: 0},
{x6: 1, x5: 0, x4: 0, x3: 1, x2: 1, x1: 1}]
sage: R = PolynomialRing(GF(2), 6, ['x%d'%(i+1) for i in range(6)], order='lex')
sage: I = R.ideal( polys )
sage: v = (I + sage.rings.ideal.FieldIdeal(R)).variety()
sage: v
[{x1: 0, x2: 0, x3: 0, x4: 0, x5: 0, x6: 0}, {x1: 1, x2: 1, x3: 1, x4: 0, x5: 0, x6: 1}]
[{x6: 0, x5: 0, x4: 0, x3: 0, x2: 0, x1: 0},
{x6: 1, x5: 0, x4: 0, x3: 1, x2: 1, x1: 1}]
Check that :issue:`13976` is fixed::
Expand Down

0 comments on commit e4aba06

Please sign in to comment.