This computes the difference in variation of the Sturm sequence of f. If a and b are not specified, the interval will be taken from negative infinity to infinity.
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 : numSturm(f) o4 = 4 |
i5 : numSturm(f,0,5) o5 = 3 |
i6 : numSturm(f,-2,2) o6 = 2 |
i7 : numSturm(f,-1,5) o7 = 3 |
In the above example, multiplicity is not included so to include this we can make the multiplicity option true in the below example.
i8 : numSturm(f,Multiplicity=>true) o8 = 5 |
i9 : numSturm(f,0,5,Multiplicity=>true) o9 = 4 |
i10 : numSturm(f,0,3,Multiplicity=>true) o10 = 3 |
If a is an InfiniteNumber, then the lower bound will be negative infinity and if b is an InfiniteNumber, then the upper bound is infinity.
i11 : numSturm(f,-infinity, 0) o11 = 1 |
i12 : numSturm(f,0,infinity) o12 = 3 |
i13 : numSturm(f,-infinity,infinity) o13 = 4 |