From 892a138853b8152e35605deedbfc8160309c2bc6 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 18 Feb 2019 13:56:03 -0500 Subject: [PATCH] mjo/polynomial.py: add a (failing!) test for Example 4 in the text. --- mjo/polynomial.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mjo/polynomial.py b/mjo/polynomial.py index 4fe4b71..8b49371 100644 --- a/mjo/polynomial.py +++ b/mjo/polynomial.py @@ -114,6 +114,22 @@ def multidiv(f, gs): sage: r.is_zero() False + Example 4 in Section 2.3 of Cox, Little, and O'Shea. This is the + same as Example 2, except with the order of ``gs`` reversed:: + + sage: R = PolynomialRing(QQ, 'x,y', order='lex') + sage: x,y = R.gens() + sage: f = x^2*y + x*y^2 + y^2 + sage: gs = [ y^2 - 1, x*y - 1 ] + sage: (qs, r) = multidiv(f, gs) + sage: (qs, r) + ([x + 1, x], 2*x + 1) + sage: r + sum( qs[i]*gs[i] for i in range(len(gs)) ) == f + True + sage: not any( g.lt().divides(m) for m in r.monomials() + ....: for g in gs ) + True + TESTS: If we get a zero remainder, then the numerator should belong to -- 2.43.2