Affine Arithmetic: Non-Linear Operations #
This file extends Affine Arithmetic with division and square root.
Key Insight #
For non-linear functions f(x), we use the Chebyshev linearization:
- Find the best linear approximation
L(x) = α·x + βover the interval - Compute the maximum approximation error
δ = max|f(x) - L(x)| - Result:
α·â + β + [-δ, δ]whereâis the affine input
This is sound because for any x ∈ [lo, hi]:
f(x) ∈ L(x) + [-δ, δ] = α·x + β + [-δ, δ]
Main definitions #
AffineForm.inv- Interval inversion with linearizationAffineForm.sqrt- Square root using Chebyshev approximationAffineForm.div- Division via multiplication by inverse
Inversion (1/x) #
Conservative inversion for affine forms.
For positive intervals [lo, hi]:
- Linear approx: L(x) = -1/(lo·hi)·x + (lo+hi)/(lo·hi)
- Max error at endpoints and midpoint
We use a simpler approach: convert to interval, invert, convert back. This loses correlation but is always sound.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Chebyshev linearization for 1/x on [lo, hi] with 0 < lo.
The optimal linear approximation minimizes max error. For 1/x, the Chebyshev approximation is: L(x) = -1/(lo·hi)·x + (lo+hi)/(lo·hi) with error bounded by (√hi - √lo)² / (2·lo·hi)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Square Root #
Square root using Chebyshev linearization.
For √x on [lo, hi] with 0 ≤ lo:
- Optimal linear: L(x) = x/(√lo + √hi) + √(lo·hi)/(√lo + √hi)
- Error: (√hi - √lo)² / 4
Simplified approach: use interval sqrt, convert back.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Chebyshev linearization for √x on [lo, hi].
Optimal approximation: L(x) = x/(2·√m) + √m/2 where m = (lo + hi)/2 is the midpoint. Error ≤ (√hi - √lo)²/4
Equations
- One or more equations did not get rendered due to their size.
Instances For
Division #
Division: a / b = a · (1/b)
Instances For
Division with Chebyshev linearization for the inverse
Equations
- a.divChebyshev b hpos = a.mul (b.invChebyshev hpos)
Instances For
Power Operations #
Natural number power
Equations
Instances For
Soundness (Placeholder) #
Inversion is sound when interval is positive
Square root is sound for non-negative inputs
Square root is sound without a nonnegativity hypothesis.