]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/polynomial.py: add another multidiv test based on an exercise.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 21 Feb 2019 01:32:23 +0000 (20:32 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 21 Feb 2019 01:32:23 +0000 (20:32 -0500)
mjo/polynomial.py

index 2b8dc2aa4cb825c06c6e0e09dc8582da0533817b..ca09ebefcf2f02dad8c659f5b1f5938f39fc248c 100644 (file)
@@ -162,6 +162,19 @@ def multidiv(f, gs):
         ....:                     for g in gs ))
         True
 
+    Exercise 8 in Section 2.4 of Cox, Little, and O'Shea says that we
+    should always get a zero remainder if we divide an element of a
+    monomial ideal by its generators::
+
+        sage: set_random_seed()
+        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: (qs, r) = multidiv(f, gs)
+        sage: r.is_zero()
+        True
+
     """
     R = f.parent()
     s = len(gs)