Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 0f2a4b7

Browse files
committed
first version
1 parent 920c16e commit 0f2a4b7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

+18-1
Original file line numberDiff line numberDiff line change
@@ -4948,7 +4948,7 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn
49484948
argument with respect to the variable given as the second
49494949
argument.
49504950
4951-
If a second argument is not provide the first variable of
4951+
If a second argument is not provided, the first variable of
49524952
the parent is chosen.
49534953
49544954
INPUT:
@@ -5022,6 +5022,23 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn
50225022
elif not self._parent._base.is_field():
50235023
raise ValueError("Resultants require base fields or integer base ring.")
50245024

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+
50255042
cdef int count = singular_polynomial_length_bounded(self._poly,20) \
50265043
+ singular_polynomial_length_bounded(other._poly,20)
50275044
if count >= 20:

0 commit comments

Comments
 (0)