ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 12 Jul 2018 05:40:22 -0500canonical polynomial vs shift polynomialhttps://ask.sagemath.org/question/42946/canonical-polynomial-vs-shift-polynomial/ What is the difference between Canonical polynomial vs Shift polynomial? Is there any particular example or case study which can be used to understand the concept regarding cryptanalysis purpose.MMumtazThu, 12 Jul 2018 05:40:22 -0500https://ask.sagemath.org/question/42946/Linear Combination for Resultanthttps://ask.sagemath.org/question/36164/linear-combination-for-resultant/Let
R.<a, b, X> = ZZ[]
f = 1 - a*X^2
g = 1 - b*X^3
I need to compute polynomials `u` and `v` such that `u f + v g = r` where `r = f.resultant(g, X)`.
Pari has a function `polresultantext` for that purpose, so one solution for my problem is
(u, v, r) = (R(p) for p in f._pari_().polresultantext(g._pari_(), 'X'))
Nevertheless, I have a few questions:
* Is there a method in Sage which directly does this?
* Is the detour via Pari the recommended solution? Or is there an alternative, e.g., in singular?
* If there is currently no method in Sage for doing this directly, what name would you recommend? `resultant_ext` ?Clemens HeubergerTue, 03 Jan 2017 23:34:11 -0600https://ask.sagemath.org/question/36164/symbolic calculation for resultanthttps://ask.sagemath.org/question/34994/symbolic-calculation-for-resultant/I want to find Resultant of trinomials of this form $x^i-x^j-1$. Is it possible to do symbolic calculation for this in sage ?vishbFri, 30 Sep 2016 00:39:14 -0500https://ask.sagemath.org/question/34994/Strange error with multivariate polynomialshttps://ask.sagemath.org/question/8917/strange-error-with-multivariate-polynomials/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](http://trac.sagemath.org/sage_trac/ticket/2693), 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
P.polynomial(x).resultant(Q.polynomial(x))
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?
Thanks!
Full error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_28.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Ui48eCx5PiA9IFJSW10KcCA9IHggKyB5CnEgPSB4KnkKcC5wb2x5bm9taWFsKHgpLnJlc3VsdGFudChxLnBvbHlub21pYWwoeCkp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/private/var/folders/5h/c6x89ch91fjgr43q99g8wbjw0000gn/T/tmpVUVLIc/___code___.py", 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/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring.py", 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
jdcMon, 23 Apr 2012 03:33:16 -0500https://ask.sagemath.org/question/8917/Difficulties with resultants and Tschirnhaus transformationshttps://ask.sagemath.org/question/24226/difficulties-with-resultants-and-tschirnhaus-transformations/ I'm experimenting with some polynomial equations, and as a test I'm working through the example given here:
http://www.oocities.org/titus_piezas/Tschirnhausen.html
Basically, in order to eliminate the first two terms of the quintic $x^5-x^4-x^3-x^2-x-1$ we need to find a transformation $y=x^2+ax+b$ (such a polynomial transformation is called a *Tschirnhaus transformation*, after its first discoverer), for which $a$ and $b$ have the effect of producing a quintic equation in $y$ but without $y^4$ or $y^3$ terms. This is as far as I've got so far:
R.<a,b> = QQ[]
S.<y> = R[]
T.<x> = S[]
p = x^5-x^4-x^3-x^2-x-1
res = p.resultant(y-x^2-a*x-b)
rc = res.coefficients()
solve([rc[-2],rc[-3]],[a,b])
TypeError: a is not a valid variable.
Drat! So I have two questions: why is `a` not a valid variable, and why can I not isolate individual coefficients of `res`? I can obtain all the coefficients of `res`, but I can't isolate just one, with something like `res.coeff(y,3)`. AlasdairSun, 21 Sep 2014 04:31:10 -0500https://ask.sagemath.org/question/24226/resultant and gcd over real ?https://ask.sagemath.org/question/11028/resultant-and-gcd-over-real/The resultant and gcd work well over rational but not over real or complex!
R.<x,y> = PolynomialRing(RR,2)
a = x^2 + y
b = x - y^2
a.resultant(b)
a.gcd(b)
This does not work while with QQ, it works. Anyone has an idea?etienneWed, 12 Feb 2014 11:03:49 -0600https://ask.sagemath.org/question/11028/Problems with computing discriminants and resultants.https://ask.sagemath.org/question/7944/problems-with-computing-discriminants-and-resultants/I have been trying to prepare a class on algebraic geometry, and make some exercises (involving resultants and discriminants of polynomials) in sage.
I have noticed the following:
1) Discriminant is not defined for multivariate polynomial rings (handled by libsingular), they could be easily implemented by something like
f.resultant(f.derivative(y),y)
Other option would be to convert our polynomials to a univariate polynomial ring (over a ring with the other variables), and then use the function defined in univariate rings. But this has the following problem:
2) Both discriminant and resultants are defined for univariate polynomial rings, but they raise an error when the variable is not 'x', and there are more variables in the base ring. I think it can be solved in three possible ways:
- Go back to the multivariate case and use the approach above.
- Change the name of the variables, in such a way that the variable of the univariate polynomial ring is called 'x', compute the resultant/discriminant and then change the names back.
- Make pari forget about the other variables involved, making them live not in a polynomial ring, but in its base field. The computation works fine there, and then we can convert the result (who lives in the fraction field, back to the original ring.
See an example:
R.<x,y>=QQ[]
f=R(x^2+y^3-1)
gf=f.polynomial(R(y))
gf.base_ring()(gf.change_ring(gf.base_ring().fraction_field()).discriminant())
I plan to submit a patch with some of this solutions, but i would like to know what do you think would be the best approach.mmarcoTue, 15 Feb 2011 01:17:34 -0600https://ask.sagemath.org/question/7944/