How this calculation works
Sturm signs count real roots without estimating where a graph crosses an axis. This page removes repeated factors by dividing by the polynomial/derivative GCD, forms the derivative and appends negative exact remainders with positive rescaling. It evaluates signs exactly at rational endpoints or by leading-term signs at infinity. Zero signs are skipped when counting variations. Optional isolation returns exact rational roots or rational brackets, while decimal values are explicitly approximate labels.
For squarefree p, V(a)−V(b) counts distinct roots in (a,b]; adjust finite endpoint roots for the selected inclusion convention.A worked example
The polynomial x³−3x+2=(x−1)²(x+2) has two distinct real roots: −2 and 1. On (−3,2], the squarefree Sturm chain has two sign variations at −3 and none at 2, giving two roots. On (−2,1], only the root at one is included; closing both endpoints gives two, opening both gives zero. The double multiplicity at one does not make it count twice.
Good to know
Rational coefficients have degree at most twelve and magnitudes within ±10⁶. Finite endpoints are exact fractions or supported decimals; infinities are allowed only in their proper positions. The zero polynomial is rejected. Isolation has exact-arithmetic, subdivision and root-bound budgets and can be rejected for difficult scaling even when count-only mode succeeds. The calculation counts distinct real roots, not multiplicity or nonreal roots. Reversed intervals are not automatically reordered.
Reference: SymPy polynomial reference — Sturm sequences (opens in a new tab) ↗
A tangent root need not produce a plotted sign crossing
A graph of (x−1)² touches the horizontal axis and stays nonnegative, so searching only for sign changes in sampled function values can miss its root completely. The squarefree reduction retains that root once, and the Sturm variation count detects it without requiring a visual crossing. The same reasoning applies when roots are too close together to resolve on a coarse chart. Root count and drawing resolution are separate properties.
A finite endpoint that is itself a root needs an explicit convention. The raw variation difference used here corresponds to (a,b], so a left endpoint root is added when the left side is closed and a right endpoint root is removed when the right side is open. A closed finite singleton [a,a] contains one distinct root exactly when p(a)=0; its open or half-open versions are empty. Infinite endpoints do not add extra roots.
The Polynomial resultant calculator using the Sylvester matrix concerns shared complex roots of two inputs, while this page counts real roots of one polynomial in an interval.
Exact brackets certify location while their decimal centers remain approximations
An isolating bracket has rational endpoints and contains one distinct root according to exact sign counts. Its displayed decimal center is a convenient numerical label, not an exact radical expression or a proof of a particular decimal expansion. Rational endpoint roots are handled separately and returned exactly, so a root such as 1/3 is not accidentally lost when an approximate global bracket overlaps the requested interval boundary.
The count-only mode needs no numerical approximation and can be useful even when isolation is expensive. The optional isolator bounds all roots, subdivides with exact arithmetic and rejects cases that exceed its budgets rather than silently omitting difficult roots. Large coefficients, tightly clustered roots or poor scaling can make that work costly. Repeated factors are removed only for distinct-root analysis; they are not evidence that the original polynomial has become squarefree or that multiplicity can be inferred from the final count.
A few questions, answered
Why are zeros skipped in the sign list?
A sign variation compares successive nonzero signs. Counting a zero as an extra positive or negative sign would change the Sturm convention and can miscount roots at an endpoint.
Does a count of zero prove the polynomial has no complex roots?
No. It only excludes real roots in the selected interval. A positive-degree polynomial can still have nonreal roots or real roots outside those bounds.