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

Commit

Permalink
first version
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmarco committed Aug 1, 2014
1 parent 920c16e commit 0f2a4b7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -5022,6 +5022,23 @@ 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() == RationalField() and self.parent().ngens() == 2 and other.base_ring() == RationalField():
resvar = self.variables()[1 - self.variables().index(variable)]
interpol = []
d1 = self.polynomial(variable).degree()
d2 = other.polynomial(variable).degree()
d = self.degree()*other.degree()
i = 0
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
U = PolynomialRing(RationalField(), variable)
while len(interpol) <= d:
if self.subs({resvar:i}).polynomial(variable).degree() == d1:
if other.subs({resvar:i}).polynomial(variable).degree() == d2:
interpol.append((i, U(self.subs({resvar:i})).resultant(U(other.subs({resvar:i})))))
i += 1
V = PolynomialRing(RationalField(), resvar)
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:
Expand Down

0 comments on commit 0f2a4b7

Please sign in to comment.