Charles Greathouse on Fri, 24 May 2013 22:00:07 +0200


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

Re: Number of real roots of a polynomial


Thank you both, this is just what I needed. It's faster (30x) and more accurate -- my old script failed (though in the conservative = "OK" direction) a few times with large coefficients.

Charles Greathouse
Analyst/Programmer
Case Western Reserve University


On Fri, May 24, 2013 at 3:51 PM, Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr> wrote:
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.