Macaulay2 » Documentation
Packages » RealRoots :: sturmCount
next | previous | forward | backward | up | index | toc

sturmCount -- the number of real roots of a univariate polynomial with rational coefficients

Description

This computes the number of real roots in the interval $(a,b]$ of a univariate polynomial f with rational coefficients. If a and b are not specified, this computes the number of real roots of f. This is computed by taking the difference in variation of the Sturm sequence of f.

i1 : R = QQ[t]

o1 = R

o1 : PolynomialRing
i2 : f = (t - 5)*(t - 3)^2*(t - 1)*(t + 1)

      5      4      3      2
o2 = t  - 11t  + 38t  - 34t  - 39t + 45

o2 : R
i3 : roots f

o3 = {-1, 1, 3, 3, 5}

o3 : List
i4 : sturmCount(f)

o4 = 4
i5 : sturmCount(f,0,5)

o5 = 3
i6 : sturmCount(f,-2,2)

o6 = 2
i7 : sturmCount(f,-1,5)	       

o7 = 3

In the above example, multiplicity is not counted. To include it, make the multiplicity option true.

i8 : sturmCount(f,Multiplicity => true)

o8 = 5
i9 : sturmCount(f,0,5,Multiplicity => true)

o9 = 4
i10 : sturmCount(f,0,3,Multiplicity => true)

o10 = 3

We give examples with infinite intervals.

i11 : sturmCount(f,-infinity, 0)

o11 = 1
i12 : sturmCount(f,0,infinity)

o12 = 3
i13 : sturmCount(f,-infinity,infinity)

o13 = 4

See also

Ways to use sturmCount:

  • sturmCount(RingElement)
  • sturmCount(RingElement,QQ,QQ)

For the programmer

The object sturmCount is a method function with options.


The source of this document is in /build/reproducible-path/macaulay2-1.25.06+ds/M2/Macaulay2/packages/RealRoots.m2:868:0.