X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Fpolynomial.py;h=8b493711924d705e17eb612efd56e390ea98e88e;hb=892a138853b8152e35605deedbfc8160309c2bc6;hp=7414bdf16b33e8178c746a3edf5b6fa4dd3f985b;hpb=4e4efc9eff5c77a2ca19002b1dfa45598e974c54;p=sage.d.git diff --git a/mjo/polynomial.py b/mjo/polynomial.py index 7414bdf..8b49371 100644 --- a/mjo/polynomial.py +++ b/mjo/polynomial.py @@ -75,6 +75,61 @@ def multidiv(f, gs): ....: for g in gs ) True + A solution ``g`` to Exercise 6 in Section 2.3 of Cox, Little, and + O'Shea that lives in the ideal generated by ``f1`` and ``f2`` but + which has nonzero remainder after division:: + + sage: R = PolynomialRing(QQ, 'x,y', order='deglex') + sage: x,y = R.gens() + sage: f1 = 2*x*y^2 - x + sage: f2 = 3*x^2*y - y - 1 + sage: I = R.ideal(f1,f2) + sage: g = 2*y*f2 + sage: g in I + True + sage: (qs,r) = multidiv(g,[f1,f2]) + sage: r.is_zero() + False + + Two solutions ``g`` to Exercise 7 in Section 2.3 of Cox, Little, and + O'Shea that live in the ideal generated by ``f1``, ``f2``, and ``f3`` + but which have nonzero remainders after division:: + + sage: R = PolynomialRing(QQ, 'x,y,z', order='deglex') + sage: x,y,z = R.gens() + sage: f1 = x^4*y^2 - z + sage: f2 = x^3*y^3 - 1 + sage: f3 = x^2*y^4 - 2*z + sage: I = R.ideal(f1,f2,f3) + sage: g = x^2*f3 + sage: g in I + True + sage: (qs, r) = multidiv(g, [f1,f2,f3]) + sage: r.is_zero() + False + sage: g = x*f2 + sage: g in I + True + sage: (qs, r) = multidiv(g, [f1,f2,f3]) + 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