John Cremona on Sat, 25 May 2013 15:30:07 +0200


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

Re: Number of real roots of a polynomial


For real cubics the number of real roots is either 1 or 3 depending on
the sign of the discriminant, with some other cases easily
distinguished if the discriminant is 0.  That's not complicated, so I
have no idea what you can have been asking Mathematica!

John

On 24 May 2013 20:59, Charles Greathouse <charles.greathouse@case.edu> wrote:
> 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.
>>
>