Sign variations of a list #
This file defines List.signVariations, for counting the number of changes of sign in a list
after all zeroes were removed. For example, [1, 0, -2, 3, 3] has two sign variations, and so
does [1, -2, 3].
This is the counting device behind Descartes' rule of signs (applied to the list of coefficients
of the polynomial) and Sturm's theorem (applied to the values of a Sturm sequence at a
point, or to the signs of its leading coefficients, adjusted by degree parity at -∞, for the
count at infinity).
Main definitions #
List.signVariations l: the number of sign variations ofl.
Main results #
List.signVariations_cons_cons_of_ne_zero: the recursion for a list starting with two nonzero entries: prependingatob :: ladds one variation exactly whensign a ≠ sign b.List.signVariations_zero_cons,List.signVariations_cons_zero_cons: zero entries are ignored.List.signVariations_map:signVariationsonly depends on the signs of the entries, so it is invariant under any map preserving signs (for instance the castℚ → ℝ, orSignType.signitself).
The number of sign variations of a list: the number of adjacent pairs of opposite sign once all zero entries have been removed.
Equations
- l.signVariations = (List.destutter (fun (x1 x2 : SignType) => x1 ≠ x2) (List.filter (fun (x : SignType) => decide (x ≠ 0)) (List.map (⇑SignType.sign) l))).length - 1
Instances For
A leading zero entry does not change the sign variations.
Zero entries do not contribute to the sign variations.
A zero entry in second position does not change the sign variations.
Prepending a nonzero entry a to a list starting with a nonzero entry b adds one sign
variation exactly when a and b have opposite signs.
signVariations only depends on the signs of the entries.
signVariations is invariant under any map that preserves signs (e.g. casts).
A run of zero entries after the head does not change the sign variations.
A list whose only nonzero entry is the head has no sign variations.
signVariations is invariant under any map that negates signs (e.g. negation).