@@ -4948,7 +4948,7 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn
4948
4948
argument with respect to the variable given as the second
4949
4949
argument.
4950
4950
4951
- If a second argument is not provide the first variable of
4951
+ If a second argument is not provided, the first variable of
4952
4952
the parent is chosen.
4953
4953
4954
4954
INPUT:
@@ -5022,6 +5022,23 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn
5022
5022
elif not self ._parent._base.is_field():
5023
5023
raise ValueError (" Resultants require base fields or integer base ring." )
5024
5024
5025
+ if self .base_ring() == RationalField() and self .parent().ngens() == 2 and other.base_ring() == RationalField():
5026
+ resvar = self .variables()[1 - self .variables().index(variable)]
5027
+ interpol = []
5028
+ d1 = self .polynomial(variable).degree()
5029
+ d2 = other.polynomial(variable).degree()
5030
+ d = self .degree()* other.degree()
5031
+ i = 0
5032
+ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
5033
+ U = PolynomialRing(RationalField(), variable)
5034
+ while len (interpol) <= d:
5035
+ if self .subs({resvar:i}).polynomial(variable).degree() == d1:
5036
+ if other.subs({resvar:i}).polynomial(variable).degree() == d2:
5037
+ interpol.append((i, U(self .subs({resvar:i})).resultant(U(other.subs({resvar:i})))))
5038
+ i += 1
5039
+ V = PolynomialRing(RationalField(), resvar)
5040
+ return self .parent()(V.lagrange_polynomial(interpol))
5041
+
5025
5042
cdef int count = singular_polynomial_length_bounded(self ._poly,20 ) \
5026
5043
+ singular_polynomial_length_bounded(other._poly,20 )
5027
5044
if count >= 20 :
0 commit comments