Commits (3)
......@@ -4948,7 +4948,7 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn
argument with respect to the variable given as the second
argument.
If a second argument is not provide the first variable of
If a second argument is not provided, the first variable of
the parent is chosen.
INPUT:
......@@ -5022,6 +5022,30 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn
elif not self._parent._base.is_field():
raise ValueError("Resultants require base fields or integer base ring.")
if self.base_ring() == other.base_ring() == RationalField() and self.parent().ngens() == 2:
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
QQ=RationalField()
y = variable
if self.parent().gens()[0] == y:
x = self.parent().gen(1)
else:
x = self.parent().gen(0)
interpol=[]
d1 = self.polynomial(y).degree()
d2 = other.polynomial(y).degree()
d = self.degree()*other.degree()
i = QQ(0)
U = PolynomialRing(QQ, y)
pf = self.polynomial(y).leading_coefficient()
pg = other.polynomial(y).leading_coefficient()
while len(interpol) <= d:
if not pf(i).is_zero():
if not pg(i).is_zero():
interpol.append((i, U(self.subs({x:i})).resultant(U(other.subs({x:i})))))
i += 1
V = PolynomialRing(QQ, x)
return self.parent()(V.lagrange_polynomial(interpol))
cdef int count = singular_polynomial_length_bounded(self._poly,20) \
+ singular_polynomial_length_bounded(other._poly,20)
if count >= 20:
......