∀ (n : ℕ) (a : ℝ), ((Polynomial.monomial n) a).comp (-Polynomial.X) = (Polynomial.monomial n) (a * (-1) ^ n)
Substituting -X into a monomial multiplies its coefficient by (-1)^n.
Part of the SVI polynomial-sign certificate (#174).
For a real polynomial that splits, the number of sign variations equals the number of positive roots with multiplicity (signVariations_eq_pos_roots). For a real symmetric matrix this gives the number of positive minus the number of negative characteristic roots as the difference of the sign variations of charpoly and charpoly.comp (-X) (signatureTest_eq_root_counts).
signVariations_pair_bound: P.signVariations + (P.comp (-X)).signVariations + P.natTrailingDegree ≤ P.natDegree.signVariations_eq_pos_roots: if P.Splits, P.signVariations equals the number of positive roots counted with multiplicity.signatureTest_eq_root_counts: for a symmetric real matrix, the sign variations of charpoly minus those of charpoly.comp (-X) equal the number of positive minus the number of negative characteristic roots.Descartes rule of signs, sign variations, positive roots, real-rooted polynomial, SVI, MSC 91G20, JEL G13
Above: what it imports. Below: what imports it.
∀ (n : ℕ) (a : ℝ), ((Polynomial.monomial n) a).comp (-Polynomial.X) = (Polynomial.monomial n) (a * (-1) ^ n)
Substituting -X into a monomial multiplies its coefficient by (-1)^n.
∀ (P : Polynomial ℝ), (P.comp (-Polynomial.X)).eraseLead = P.eraseLead.comp (-Polynomial.X)
Erasing the leading term commutes with the substitution X ↦ -X.
∀ (P : Polynomial ℝ), P.eraseLead ≠ 0 → P.eraseLead.natTrailingDegree = P.natTrailingDegree
Erasing the leading term of a polynomial with nonzero remainder keeps its trailing degree.
∀ (x y u : ℝ), x ≠ 0 → y ≠ 0 → u ≠ 0 → ((if SignType.sign x = -SignType.sign y then 1 else 0) + if SignType.sign (-u * x) = -SignType.sign (u * y) then 1 else 0) = 1
For nonzero x, y, u, exactly one of the sign-change tests for (x, y) and (-u*x, u*y) holds.
∀ (P : Polynomial ℝ), P.signVariations + (P.comp (-Polynomial.X)).signVariations + P.natTrailingDegree ≤ P.natDegree
The two Descartes counts cannot exceed the number of nonzero roots available in a completely split polynomial. This bound itself needs no split hypothesis.
∀ (s : Multiset ℝ), Multiset.countP (fun x => 0 < x) s + Multiset.countP (fun x => x < 0) s + Multiset.count 0 s = s.card
A real multiset splits into its positive, negative and zero elements.
∀ (P : Polynomial ℝ), P.Splits → P.signVariations = Multiset.countP (fun x => 0 < x) P.roots
Descartes' rule is exact when all roots are real, with multiplicities and zero roots handled without nondegeneracy assumptions.
∀ {n : ℕ} (M : Matrix (Fin n) (Fin n) ℝ), M.IsSymm → ↑M.charpoly.signVariations - ↑(M.charpoly.comp (-Polynomial.X)).signVariations = ↑(Multiset.countP (fun x => 0 < x) M.charpoly.roots) - ↑(Multiset.countP (fun x => x < 0) M.charpoly.roots)The exact characteristic-coefficient rule for any real symmetric matrix.