Ask Your Question

Strange error with multivariate polynomials

asked 2012-04-23 03:33:16 -0500

jdc gravatar image

updated 2015-09-25 15:22:18 -0500

tmonteil gravatar image

Hi -

I'm trying to calculate the resultant (with respect to one variable, say x) of a pair of 2-variable polynomials. Following some advice I found in this trac ticket, I tried entering something like this:

R.<x,y> = RR[]
P = 4*x^3*y^2 + 7*x^5*y - 3*x*y^4
Q = 5*x^3*y^3 - 9*y^2

However, P.polynomial(x) returns the error:

ValueError: max() arg is an empty sequence

(Full error message pasted below.) Same problem with P.polynomial(y), etc. It seems to work okay if the coefficient ring is ZZ or QQ instead of RR.

Does anyone know why this is happening, or of a different workaround for calculating these resultants?


Full error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "", line 10, in <module>
    exec compile(u'open("","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Ui48eCx5PiA9IFJSW10KcCA9IHggKyB5CnEgPSB4KnkKcC5wb2x5bm9taWFsKHgpLnJlc3VsdGFudChxLnBvbHlub21pYWwoeCkp"),globals())+"\\n"); execfile(os.path.abspath(""))
  File "", line 1, in <module>

  File "/private/var/folders/5h/c6x89ch91fjgr43q99g8wbjw0000gn/T/tmpVUVLIc/", line 5, in <module>
    exec compile(u'p.polynomial(x).resultant(q.polynomial(x))
  File "", line 1, in <module>

  File "multi_polynomial.pyx", line 452, in sage.rings.polynomial.multi_polynomial.MPolynomial.polynomial (sage/rings/polynomial/multi_polynomial.c:5376)
  File "parent.pyx", line 988, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:7355)
  File "coerce_maps.pyx", line 82, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3311)
  File "coerce_maps.pyx", line 77, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3214)
  File "/Applications/", line 407, in _element_constructor_
    return C(self, x, check, is_gen, construct=construct, **kwds)
  File "polynomial_real_mpfr_dense.pyx", line 87, in sage.rings.polynomial.polynomial_real_mpfr_dense.PolynomialRealDense.__init__ (sage/rings/polynomial/polynomial_real_mpfr_dense.c:3418)
ValueError: max() arg is an empty sequence
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2012-04-23 18:14:38 -0500

Volker Braun gravatar image

This is now Trac #12871

edit flag offensive delete link more


Thanks for opening a ticket, Volker. By the way, I managed to get at the resultants I need by using "pari('polresultant(...))",

jdc gravatar imagejdc ( 2012-04-24 05:46:48 -0500 )edit

answered 2015-09-25 09:57:38 -0500

B r u n o gravatar image

This is solved by #17190!

sage: R.<x,y> = RR[]
sage: P = 4*x^3*y^2 + 7*x^5*y - 3*x*y^4
sage: Q = 5*x^3*y^3 - 9*y^2
sage: P.polynomial(x)
7.00000000000000*y*x^5 + 4.00000000000000*y^2*x^3 - 3.00000000000000*y^4*x
sage: P.polynomial(x).resultant(Q.polynomial(x))
151875.000000000*y^26 - 4.59270000000000e6*y^19 - 1.16640000000000e6*y^18 - 2.02538070000000e7*y^13
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-04-23 03:33:16 -0500

Seen: 291 times

Last updated: Sep 25 '15