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

Commit

Permalink
Compute discriminant of power series polynomial using substitution.
Browse files Browse the repository at this point in the history
While other tickets care about making the resultant more flexible, to allow
its operation on polynomials over power series, for the special case of the
discriminant the substitution is certainly a viable and fast alternative.
  • Loading branch information
gagern committed Mar 27, 2014
1 parent d5e0307 commit 66a8c19
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/sage/rings/polynomial/polynomial_element.pyx
Expand Up @@ -4989,11 +4989,24 @@ cdef class Polynomial(CommutativeAlgebraElement):
sage: E2 = E1.subs(t1=t2, x1=x2, y1=y2)
sage: det(mu*E1 + E2).discriminant().degrees()
(24, 12, 12, 8, 8, 8, 8)
This addresses an issue raised by :trac:`15061`::
sage: R.<T> = PowerSeriesRing(QQ)
sage: F = R([1,1],2)
sage: RP.<x> = PolynomialRing(R)
sage: P = x^2 - F
sage: P.discriminant()
4 + 4*T + O(T^2)
"""
# Late import to avoid cyclic dependencies:
from sage.rings.power_series_ring import is_PowerSeriesRing
if self.is_zero():
return self.parent().zero_element()
poly = self
if is_MPolynomialRing(self.parent().base_ring()):
base_ring = self.parent().base_ring()
if (is_MPolynomialRing(base_ring) or
is_PowerSeriesRing(base_ring)):
# It is often cheaper to compute discriminant of simple
# multivariate polynomial and substitute the real
# coefficients into that result (see #16014).
Expand Down

0 comments on commit 66a8c19

Please sign in to comment.