well, you didn't paste the correct polynomial:
(the least degree is 12, not 1).
so one gets

sage: for (q,n) in p.squarefree_decomposition(): 

....:     print q.degree(), n, gp.polsturm(q) 

....:     

8 1 8
2 2 2
1 12 1
which gives you 11 real roots, just as computed by .roots()

Right, I forgot about Sturm sequences :-( 
They are certainly way, way more efficient than actual root computation.


On Monday, 11 May 2015 08:28:24 UTC+1, vdelecroix wrote:
>
> On 11/05/15 07:43, Phoenix wrote: 
> > 
> > 1296*x^24 - 20736*x^22 + 129600*x^20 - 393984*x^18 + 584496*x^16 - 
> 362880*x^14 + 62208*x 
>
> For the number of real roots, you can use PARI/GP (but your polynomial 
> needs to be square free) 
>
> sage: x = polygen(QQ) 
> sage: p = 1296*x^24 - 20736*x^22 + 129600*x^20 - 393984*x^18 + 
> 584496*x^16 - 362880*x^14 + 62208*x 
> sage: for (q,n) in p.squarefree_decomposition(): 
> ....:    print q.degree(), n, gp.polsturm(q) 
> 24 1 4 
>
> The command `gp.polsturm` returns the number of real roots of a 
> squarefree polynomial. The above code shows that the polynomial was 
> square free. And it has 4 real roots. There is *no* need to compute the 
> roots to determine the number of them which are real!! 
>
> Vincent 
>

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

Reply via email to