There is a different answer from Maxima, at least different from what is 
posted.

algebraic:true;
tellrat(x^3+3*x+1);
resultant(f,g,y)
gives

2201*x^2-2042*x-885

Note that Maxima can also compute the resultant wrt x without
renaming variables.


On Thursday, August 7, 2014 10:25:19 AM UTC-7, Bill Hart wrote:
>
> Thanks Peter. That clears it up well.
>
> I actually thought that you could specify which variable Pari/GP took the 
> resultant with respect to. But this obviously doesn't get you around the 
> variable ordering issue.
>
> I was vaguely aware of that problem, but had no idea I wasn't working 
> around it already.
>
> I'm glad to hear this is also fixed in Sage. I tend to use the latest 
> stable release of Sage, but not usually the beta, so I missed that this had 
> been fixed.
>
> Thanks again for the help.
>
> Bill.
>
> On Thursday, 7 August 2014 17:02:56 UTC+2, Peter Bruin wrote:
>>
>> Hi Bill, 
>>
>> This bug was only fixed two weeks ago (Trac tickets #15061 and #16360), 
>> so it only works in the most recent beta versions of Sage. 
>>
>> The reason why PARI gives the wrong answer has to do with variable 
>> ordering; for example, f is translated to 
>>
>> f = Mod(-3*y^2*x^2 + (-y^2 - 3*y + 1)*x - 2, x^3 + 3*x + 1) 
>>
>> which is not a polynomial at all.  If you want to do this computation in 
>> PARI, you have to replace x by a variable with lower priority than y: 
>>
>> gp > y; z; 
>> gp > f = (z^4*y^2 + (z^3 + 1)*y + (z - 2)) * Mod(1, z^3 + 3*z + 1) * 
>> Mod(1, 487326487); 
>> gp > g = ((z^3 + 2*z + 1)*y^2 + (z + 1)*y + (z^4 + z^3 + z^2 + 1)) * 
>> Mod(1, z^3 + 3*z + 1) * Mod(1, 487326487); 
>> gp > polresultant(f, g) 
>> %4 = Mod(Mod(2201, 487326487)*z^2 + Mod(487324445, 487326487)*z + 
>> Mod(487325602, 487326487), z^3 + 3*z + 1) 
>>
>> Peter 
>>
>>
>> Bill Hart wrote: 
>>
>> > I think that is the correct answer. It agrees with one of the answers 
>> > Magma gives, and someone else says Mathematica agrees. 
>> > My version of Sage is 'Sage Version 6.2, Release Date: 2014-05-06' 
>> > Bill. 
>> > 
>> > On Thursday, 7 August 2014 16:10:52 UTC+2, Frédéric Chapoton wrote: 
>> > 
>> >   Hello, 
>> >   it works for me on sage 6.3.beta8, giving: 
>> >   2201*xbar^2 + 487324445*xbar + 487325602 
>> >   which version of sage do you use ? type version() to know that. 
>> >   By the way, you should rather have asked that question on 
>> sage-support 
>> >   or on ask.sagemath.org 
>> >   Le jeudi 7 août 2014 16:03:43 UTC+2, Bill Hart a écrit : 
>> > 
>> >  I'm having difficulties with the polynomial resultant function in 
>> >  Sage. 
>> >  I'm trying to find the resultant of two polynomials. 
>> >  I compute the resultant of the polynomials below to be: 
>> >  6768454*x^2+257200062*x+20305258 
>> >  Pari/GP says the resultant is 1, which I don't believe, so I thought 
>> >  I'd try Sage 6.2: 
>> >  sage: R = Integers(487326487) 
>> >  sage: S.<x> = PolynomialRing(R) 
>> >  sage: T = QuotientRing(S, x^3 + 3*x + 1) 
>> >  sage: U.<y> = PolynomialRing(T) 
>> >  sage: f = x^4*y^2 + (x^3 + 1)*y + (x - 2) 
>> >  sage: g = (x^3 + 2*x + 1)*y^2 + (x + 1)*y + (x^4 + x^3 + x^2 + 1) 
>> >  sage: f.resultant(g) 
>> > 
>>  --------------------------------------------------------------------------- 
>>
>> >  PariError                                 Traceback (most recent call 
>> >  last) 
>> >  <ipython-input-9-14f40f55d982> in <module>() 
>> >  ----> 1 f.resultant(g) 
>> > 
>>  
>> /usr/local/sage/sage-current/local/lib/python2.7/site-packages/sage/structure/element.so
>>  
>>
>> >  in sage.structure.element.NamedBinopMethod.__call__ 
>> >  (sage/structure/element.c:25475)() 
>> > 
>>  
>> /usr/local/sage/sage-current/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_element.so
>>  
>>
>> >  in sage.rings.polynomial.polynomial_element.Polynomial.resultant 
>> >  (sage/rings/polynomial/polynomial_element.c:33908)() 
>> > 
>>  
>> /usr/local/sage/sage-current/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_element.so
>>  
>>
>> >  in sage.rings.polynomial.polynomial_element.Polynomial._pari_with_name 
>> >  (sage/rings/polynomial/polynomial_element.c:33119)() 
>> > 
>>  
>> /usr/local/sage/sage-current/local/lib/python2.7/site-packages/sage/libs/pari/gen.so
>>  
>>
>> >  in sage.libs.pari.gen.gen.Polrev (sage/libs/pari/gen.c:12936)() 
>> > 
>>  
>> /usr/local/sage/sage-current/local/lib/python2.7/site-packages/sage/libs/pari/handle_error.so
>>  
>>
>> >  in sage.libs.pari.handle_error._pari_handle_exception 
>> >  (sage/libs/pari/handle_error.c:1178)() 
>> >  PariError: variable must have higher priority in gtopoly 
>> >  ------------------- 
>> >  Magma gives two different answers, depending on whether you coerce the 
>> >  coefficients of f and g into T or not (I don't see why). Neither agree 
>> >  with the Pari/GP answer, or the answer I compute myself (which is very 
>> >  likely wrong). 
>> >  Coercing the coefficients into T makes no difference to the resulting 
>> >  error in Sage. 
>> >  Can someone tell me what I am doing wrong here. I obviously don't know 
>> >  what I'm doing. I've never really tried to do any genuine computer 
>> >  algebra before. 
>> >  Bill. 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> Groups 
>> > "sage-devel" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an 
>> > email to sage-devel+...@googlegroups.com. 
>> > To post to this group, send email to sage-...@googlegroups.com. 
>> > Visit this group at http://groups.google.com/group/sage-devel. 
>> > For more options, visit https://groups.google.com/d/optout. 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to