Kernel-checked gain bounds on frequency intervals #
For a rational model G : Cslib.LinearAlgebra.RatLTI n m p and a SISO entry h = H i j of its
transfer function H s = C (s I - A)⁻¹ B + D (LTISystem.transferFunction), this module computes,
exactly over ℚ, real polynomials N and Q with
‖H (ω * I) i j‖² = N (ω²) / Q (ω²), Q (ω²) = |χ (i ω)|²,
and checks gain specifications on frequency bands with the Sturm sign checks of
CslibFrontier.Foundations.Algebra.Polynomial.RealRoot.IntervalSign. Every check is a Boolean
function that the kernel evaluates by decide +kernel.
The resolvent #
The Faddeev–LeVerrier recurrence (Cslib.LinearAlgebra.resolvent) computes matrices
Y₀, …, Yₙ₋₁ and coefficients c₀, …, cₙ (with cₙ = 1) such that, in exact arithmetic,
Σ Yₖ sᵏ = adj (s I - A) and Σ cₖ sᵏ = det (s I - A). Its correctness is not proved here.
Instead Cslib.LinearAlgebra.resolventCheck checks the coefficients of the polynomial identity
(s I - A) (Σ Yₖ sᵏ) = (Σ cₖ sᵏ) I, that is Yₖ₋₁ - A Yₖ = cₖ I for k = 0, …, n, together with
the trace identities tr Yₖ = (k + 1) cₖ₊₁ that the recurrence also satisfies. Whenever the
check passes, χ = Σ cₖ sᵏ is the characteristic polynomial of A
(Cslib.LinearAlgebra.resolventCheck_charpoly, from the trace identities and Jacobi's formula
Matrix.derivative_det_adjugate), at every complex s with χ(s) ≠ 0 the matrix s I - A has
the inverse χ(s)⁻¹ Σ Yₖ sᵏ (Cslib.LinearAlgebra.resolventCheck_inv), and
H s i j = num(s) / χ(s) for the numerator num = c_i Y b_j + d_ij χ
(Cslib.LinearAlgebra.RatLTI.transferFunction_apply_eq).
Squared gain on the imaginary axis #
A real polynomial f (s) = E (s²) + s O (s²) takes the value E (-ω²) + i ω O (-ω²) at s = i ω;
Cslib.LinearAlgebra.evenOdd computes the coefficient lists of u ↦ E (-u) and u ↦ O (-u), so
that |f (i ω)|² = E² + u O² at u = ω² (Cslib.LinearAlgebra.sqAbsImag). The gain polynomials
RatLTI.gainNum and RatLTI.gainDen are these for the numerator and for χ. They are polynomials
in u = ω², which halves the degree that the Sturm checks see and makes |h|² even in ω, so a
band constrains |ω|.
Gain checks #
A Cslib.LinearAlgebra.FreqBand is lo ≤ |ω| ≤ hi, or lo ≤ |ω| when hi = none, with rational
0 ≤ lo. RatLTI.gainLe G i j B γ² checks that Q has no root for ω² in the band (so iωI - A
is invertible there) and γ² Q - N ≥ 0; RatLTI.gainGe checks N - γ² Q ≥ 0 instead.
Acceptance gives ‖H (ω * I) i j‖ ≤ γ (RatLTI.norm_le_of_gainLe) or γ ≤ ‖H (ω * I) i j‖
(RatLTI.le_norm_of_gainGe) on the band. A bound that the gain attains in the interior of the
band, or at an endpoint where γ² Q - N has a multiple root, is rejected (see nonnegOn), so a
tight bound may need a slightly larger γ.
Decibels #
A rational level L = p / q dB bounds the gain by 10 ^ (L / 20), which is irrational in general.
The bound goes through a rational γ²: Cslib.LinearAlgebra.dbLe γ² L checks
(γ²) ^ (10 q) ≤ 10 ^ p exactly, so γ² ≤ 10 ^ (L / 10), and RatLTI.norm_le_db_of_gainLe
gives ‖H (ω * I) i j‖ ≤ 10 ^ (L / 20), the statement 20 log₁₀ ‖H‖ ≤ L without the junk value
log 0 = 0. Lower bounds are stated as L ≤ 20 * Real.logb 10 ‖H (ω * I) i j‖
(RatLTI.db_le_of_gainGe).
Violation witnesses #
A rejected check does not by itself tell a violated specification from a certificate that is
only too tight, such as a bound that the gain touches. RatLTI.gainLeVerdict,
RatLTI.gainGeVerdict, RatLTI.dbLeVerdict and RatLTI.dbGeVerdict return a
Cslib.LinearAlgebra.GainVerdict: proved when the check accepts, violated ω for a rational
ω in the band at which the specification fails, or inconclusive. The witness is searched
(untrusted) where the checked polynomial P (ω²) is negative, at the band's edges and near the
roots of P (ω²) from Cslib.RealRoot.isolateRoots (Cslib.LinearAlgebra.witnessCandidates).
Only the final check is trusted: RatLTI.pointOk checks that ω is in the band and
Q (ω²) ≠ 0, and then i ω I - A is invertible and ‖H (ω * I) i j‖² = N (ω²) / Q (ω²) is
the rational RatLTI.sqGainAt i j ω (RatLTI.sq_norm_eq_sqGainAt), which is compared with γ²,
or with the decibel level through dbLe and dbGe, exactly. At a root of Q the matrix
inverse in H is a junk value, so no witness is reported there. GainVerdict.Holds states what
each outcome means. A bound attained exactly, like the 0 dB bound of a low-pass at ω = 0, has
no witness and is reported inconclusive.
DC gain #
RatLTI.dcGain is D + c₀⁻¹ C Y₀ B, which is D - C A⁻¹ B since -A Y₀ = c₀ I.
RatLTI.dcCheck checks the resolvent and c₀ ≠ 0; acceptance proves that A is invertible, that
D - C A⁻¹ B is dcGain exactly (RatLTI.dcGain_eq) and that H 0 is its image in ℂ
(RatLTI.transferFunction_zero_eq).
Main definitions #
Cslib.LinearAlgebra.resolvent,Cslib.LinearAlgebra.resolventCheck: the Faddeev–LeVerrier data and its check.Cslib.LinearAlgebra.RatLTI.numCoeffs,RatLTI.gainNum,RatLTI.gainDen.Cslib.LinearAlgebra.FreqBand,RatLTI.gainLe,RatLTI.gainGe,Cslib.LinearAlgebra.dbLe,Cslib.LinearAlgebra.dbGe,RatLTI.dcGain,RatLTI.dcCheck.Cslib.LinearAlgebra.GainVerdict,GainVerdict.Holds,RatLTI.sqGainAt,RatLTI.pointOk,RatLTI.gainLeVerdict,RatLTI.gainGeVerdict,RatLTI.dbLeVerdict,RatLTI.dbGeVerdict, and the untrusted searchCslib.LinearAlgebra.witnessCandidates.
Main results #
Cslib.LinearAlgebra.resolventCheck_charpoly,RatLTI.ofCoeffList_charCoeffs: an accepted resolvent computes the characteristic polynomial.RatLTI.gainDen_eq_normSq_det,RatLTI.gainDen_ne_zero_iff,RatLTI.sq_norm_transferFunction:Q (ω²) = |det (iωI - A)|², and‖H (ω * I) i j‖² = N (ω²) / Q (ω²)whereveriωI - Ais invertible.RatLTI.sq_norm_le_of_gainLe,RatLTI.norm_le_of_gainLe,RatLTI.le_sq_norm_of_gainGe,RatLTI.le_norm_of_gainGe: gain bounds on a band.RatLTI.norm_le_db_of_gainLe,RatLTI.rpow_le_norm_of_gainGe,RatLTI.db_le_of_gainGe: decibel forms.Cslib.LinearAlgebra.dbLe_eq_true_iff,Cslib.LinearAlgebra.dbGe_eq_true_iff: the decibel checks decidex ≤ 10 ^ (L / 10)and10 ^ (L / 10) ≤ x.RatLTI.sq_norm_eq_sqGainAt: the exact squared gain at an accepted rational frequency.RatLTI.gainLeVerdict_holds,RatLTI.gainGeVerdict_holds,RatLTI.dbLeVerdict_holds,RatLTI.dbGeVerdict_holds: each verdict is correct;RatLTI.dbGeVerdict_violated: a lower decibel violation has a positive gain below10 ^ (L / 20).RatLTI.dcGain_eq,RatLTI.transferFunction_zero_eq: the DC gain.
The resolvent adj (s I - A) and its check #
The Faddeev–LeVerrier data of the n × n matrix with rows A: the matrices [Y₀, …, Yₙ₋₁],
with Σ Yₖ sᵏ = adj (s I - A), and the coefficients [c₀, …, cₙ] of det (s I - A) in exact
arithmetic. Only resolventCheck is trusted.
The resolvent identity. If the resolvent check accepts, then for every s in a
commutative ℚ-algebra, (s I - A) (Σₖ sᵏ Yₖ) = χ(s) I with χ = ofCoeffList cs.
At every s in a field with χ(s) ≠ 0, an accepted resolvent inverts s I - A:
(s I - A)⁻¹ = χ(s)⁻¹ Σₖ sᵏ Yₖ.
The resolvent check pins down the characteristic polynomial. If it accepts, then
ofCoeffList cs is the characteristic polynomial of A: multiplying the identity
(X I - A) Y = χ I by adj (X I - A) gives charpoly A • Y = χ • adj (X I - A); its trace,
with Jacobi's formula tr adj (X I - A) = (charpoly A)' and the checked tr Y = χ', gives
charpoly A * χ' = χ * (charpoly A)', and both polynomials are monic of degree n.
Squared modulus on the imaginary axis #
The coefficient lists of u ↦ E (-u) and u ↦ O (-u) for f (s) = E (s²) + s O (s²), so
that f (i ω) = E' (ω²) + i ω O' (ω²) (Cslib.LinearAlgebra.aeval_evenOdd).
The value of a real polynomial at i ω from its even and odd parts.
|f (i ω)|² is the value of sqAbsImag f at ω².
Transfer functions of rational models #
Whether the resolvent of A passes resolventCheck.
The transfer function from the resolvent. If the resolvent check accepts and
χ (s) ≠ 0, then H s i j = num (s) / χ (s).
χ is the characteristic polynomial of A, for an accepted resolvent.
Q (ω²) = |det (i ω I - A)|², for an accepted resolvent.
Q (ω²) ≠ 0 exactly where i ω I - A is invertible, for an accepted resolvent.
Squared gain as a ratio of polynomials. If the resolvent check accepts, then at every real
ω where i ω I - A is invertible, ‖H (ω * I) i j‖² = N (ω²) / Q (ω²), and Q (ω²) > 0.
Gain checks on frequency bands #
Membership of a real angular frequency in a band.
Decibels #
Whether 0 ≤ x ≤ 10 ^ (L / 10), decided in ℚ as x ^ (10 q) ≤ 10 ^ p for L = p / q in
lowest terms.
Whether 10 ^ (L / 10) ≤ x, decided in ℚ as 10 ^ p ≤ x ^ (10 q) for L = p / q in lowest
terms (and 0 < x).
Upper gain bound in decibels: ‖H (ω * I) i j‖ ≤ 10 ^ (L / 20), that is
20 log₁₀ ‖H (ω * I) i j‖ ≤ L where the gain is nonzero, on the band, from gainLe with a
rational γ² accepted by dbLe γ² L.
Lower gain bound in decibels: 10 ^ (L / 20) ≤ ‖H (ω * I) i j‖ on the band, from
gainGe with a rational γ² accepted by dbGe γ² L.
DC gain #
DC-gain check: the resolvent check, and c₀ = χ (0) ≠ 0.
Violation witnesses #
Whether a rational frequency lies in the band.
The outcome of a gain check on a band: the specification is proved on the whole band, it is violated at a stated rational frequency, or neither is established.
- proved : GainVerdict
The specification holds on the whole band.
- violated (ω : ℚ) : GainVerdict
The specification fails at the rational frequency
ωof the band. - inconclusive : GainVerdict
Neither a proof nor a violation was found.
Instances For
What a verdict asserts about a specification spec ω of the frequency response of G on the
band B. proved: spec holds on the whole band. violated ω: ω is in the band,
i ω I - A is invertible (so H (ω * I) is the value of the transfer function, not a junk value
of the matrix inverse), and spec fails at ω. inconclusive: nothing.
proved if the check ok accepts, otherwise violated ω for a witness ω returned by the
search w, otherwise inconclusive. The search is a thunk, run only when ok is false.
Sign bisection of [a, b] for the polynomial with coefficient list P: while the values at the
ends have strictly opposite signs, keep the half on which they still do, for at most fuel
steps; the result is the final pair of ends.
Candidate witnesses (untrusted sampling heuristic). Rational frequencies at which to look
for a negative value of P (ω²) on the band B: the band's edges (for a half-line, a point
beyond the Cauchy bound of P (ω²), past which its sign is constant), the ends inside the band of
the isolating intervals of the real roots of P (ω²) (Cslib.RealRoot.isolateRoots), each
refined by 32 steps of bisectSign, and the midpoints of consecutive such points. The refined
ends lie close to the roots, which matters where the negative values are confined near a pole of
the gain. The samples need not meet every sign of P (ω²) on the band: a rational point never
attains a zero at an irrational root, such as ω = √2 for P (u) = u - 2 on [0, 2], and the
completeness theorem for isolateRoots assumes a separable polynomial, which is not required
here. Nothing about the list is proved: every candidate is checked by RatLTI.pointOk.
Soundness of the witness-point check. At an accepted rational ω: ω is in the band,
i ω I - A is invertible, and ‖H (ω * I) i j‖² = sqGainAt i j ω exactly.
Upper decibel verdict for the level L: gainLe with γ² and dbLe γ² L, or a
rational ω in the band whose squared gain g fails dbLe g L, that is 10 ^ (L / 10) < g,
searched as in gainLeVerdict.
Lower decibel verdict for the level L: gainGe with γ² and dbGe γ² L, or a
rational ω in the band whose squared gain g > 0 fails dbGe g L, that is
g < 10 ^ (L / 10), searched as in gainGeVerdict.
The upper gain verdict is correct: proved means ‖H (ω * I) i j‖² ≤ γ² on the band;
violated ω means γ² < ‖H (ω * I) i j‖² at ω in the band, where i ω I - A is invertible.
The lower gain verdict is correct: proved means γ² ≤ ‖H (ω * I) i j‖² on the band;
violated ω means ‖H (ω * I) i j‖² < γ² at ω in the band, where i ω I - A is invertible.
The upper decibel verdict is correct: proved means ‖H (ω * I) i j‖ ≤ 10 ^ (L / 20) on
the band; violated ω means 10 ^ (L / 20) < ‖H (ω * I) i j‖ at ω in the band, where
i ω I - A is invertible.
The lower decibel verdict is correct: proved means L ≤ 20 log₁₀ ‖H (ω * I) i j‖ on the
band; violated ω means that this fails at ω in the band, where i ω I - A is invertible.
Since Real.logb 10 0 = 0, the failure alone does not exclude a zero gain;
dbGeVerdict_violated adds that the gain at ω is positive and below 10 ^ (L / 20).
A lower decibel violation has a positive gain: if dbGeVerdict returns violated ω, then
ω is in the band, i ω I - A is invertible and 0 < ‖H (ω * I) i j‖ < 10 ^ (L / 20).