Bill Allombert on Fri, 24 May 2013 21:51:59 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Number of real roots of a polynomial


On Fri, May 24, 2013 at 03:41:49PM -0400, Charles Greathouse wrote:
> Given a univariate polynomial, how can I determine the number of real
> solutions with gp?
> 
> Usually I look at polroots(P) and count the number of roots which have an
> imaginary part which 'looks like' 0. But I'd like a solution that certifies
> that the zeros are not merely close to being real.
> 
> A solution giving the number of distinct real roots would be equally useful
> for me. Speed is important in this application, so if there's a good way to
> do it with the library that would be fine (though I'm just using GP now).

Assuming your polynomial is squarefree, polsturm will give you the answer.

Try
???"real roots"

Cheers,
Bill.