From b3645cbffe999681a590ffbafa2b2ca9766e68cd Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 8 Dec 2019 21:23:33 -0500 Subject: [PATCH] mjo/polynomial.py: add hacks for SageMath Trac #28855. --- mjo/polynomial.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mjo/polynomial.py b/mjo/polynomial.py index 9ef2902..55ada9a 100644 --- a/mjo/polynomial.py +++ b/mjo/polynomial.py @@ -140,7 +140,8 @@ def multidiv(f, gs): sage: x,y,z = R.gens() sage: s = ZZ.random_element(1,5).abs() sage: gs = [ R.random_element() for idx in range(s) ] - sage: f = R.random_element(ZZ.random_element(10).abs()) + sage: # hack for SageMath Trac #28855 + sage: f = R(R.random_element(ZZ.random_element(10).abs())) sage: (qs, r) = multidiv(f,gs) sage: r != 0 or f in R.ideal(gs) True @@ -153,7 +154,8 @@ def multidiv(f, gs): sage: R = PolynomialRing(QQ, 'x,y,z') sage: s = ZZ.random_element(1,5).abs() sage: gs = [ R.random_element() for idx in range(s) ] - sage: f = R.random_element(ZZ.random_element(10).abs()) + sage: # hack for SageMath Trac #28855 + sage: f = R(R.random_element(ZZ.random_element(10).abs())) sage: (qs, r) = multidiv(f,gs) sage: r + sum( qs[i]*gs[i] for i in range(len(gs)) ) == f True @@ -169,7 +171,8 @@ def multidiv(f, gs): sage: R = PolynomialRing(QQ,'x,y,z') sage: gs = R.random_element().monomials() sage: I = R.ideal(gs) - sage: f = I.random_element(ZZ.random_element(5).abs()) + sage: # hack for SageMath Trac #28855 + sage: f = R(I.random_element(ZZ.random_element(5).abs())) sage: (qs, r) = multidiv(f, gs) sage: r.is_zero() True -- 2.44.2