Exponential enclosures for interval_dyadic_real #
This file defines an inclusion operation for the interval_dyadic_real inclusion family that
encloses Real.exp of an interval.
Implementation notes #
The exp of the endpoints is constructed by evaluating the Taylor partial sum up to the required
precision level. The exponent is rewritten as exp x = exp (x / m) ^ m, where m is an integer
chosen so that |x / m| < 1 / 2. The exponent is divided further by 2 ^ k (with k growing as
√prec) so that the Taylor series converges faster, and k squarings with outward rounding undo
that division.
This file is opt-in so that dyadic_interval doesn't import unnecessary theories.
TODO #
For larger exponents, we would eventually want to implement another optimisation that shifts the
exp exponent by multiples of log 2 (which only shifts the exponent of the dyadic result).
This requires a certified computation of log 2 to arbitrary precision, which is available as
Inclusion.IntervalDyadicReal.logTwo (with bounds Inclusion.IntervalDyadicReal.logTwo_spec).
An enclosure of exp (a / b) by the first n terms of its Taylor series and the remainder
bound of Real.exp_bound, rounded outward to precision prec. This is only intended for use
when | a / b | ≤ 1.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Square I k times, rounding outward to the 2 ^ (-prec) grid after each squaring.
Compared with the exact I.pow (2 ^ k), the roundings add an error of less than about
2 ^ (k + 1) * max 1 M ^ (2 ^ k - 1) steps of 2 ^ (-prec), where M is the largest absolute
value in I. So the error stays below 2 ^ (-q) when prec is at least about
q + k + 1 + (2 ^ k - 1) * log₂ (max 1 M).
The roundings keep the endpoints on the 2 ^ (-prec) grid, where I.pow (2 ^ k) would have
endpoints with 2 ^ k times as many bits.
Equations
- Inclusion.IntervalDyadicReal.squareRoundOut 0 I prec = I
- Inclusion.IntervalDyadicReal.squareRoundOut k_2.succ I prec = Inclusion.IntervalDyadicReal.squareRoundOut k_2 (Inclusion.IntervalDyadicReal.roundOut (I.pow 2) prec) prec
Instances For
An enclosure of exp x by rewriting as (exp (x / N) ^ 2 ^ k) ^ m, where N = m * 2 ^ k, so
that |x / N| < 2 ^ (-1 - k) to make the Taylor series converge quickly. The interval is rounded
outward after the power to drop the redundant bits for the consumers.
Some relevant precision constants are chosen as follows:
m = ⌊2 |x|⌋ + 1to shrink the exponent below1/2.k, the number of squarings, is an argument with default⌊√prec⌋, which balances the cost of the squarings against that of the Taylor terms.powerBitsandtaylorTermsbelow are computed fromk, so everykgives the same precision and only the cost changes. Withk = 0, aboutprec / 2terms are needed.precTayloris the precision ofexp (x / N)requested. The powers turn an absolute errorδonexp (x / N)into aboutN * exp x * δonexp x(the derivative of theN-th power isN * exp (x / N) ^ (N - 1)). SoprecTayloradds three amounts toprec.powerBitsis at least⌈ log₂ N ⌉.sizeBits = ⌊ 1.5x ⌋ + 1(1.5 > log₂ e) which bounds the number of bits above 1 forexp x.- a constant (
8here) so that the powered interval is narrower than2 ^ (-prec - 1). Rounding it outward to the2 ^ (-prec - 1)grid then spans at most two grid steps, so the result has width at most2 ^ (-prec). It also absorbs the roundings insquareRoundOut, which add less than four steps of2 ^ (-precTaylor)before the amplification.
taylorTermsterms bring the Taylor remainder below2 ^{-precTaylor}. Each term shrinks the remainder by at least1 + kbits due to the2 ^ (-1 - k)bound on the exponent, with further shrinking from the factorial. It's sufficient for the number of termsnto satisfy(1 + k) n + log₂ (n!) ≥ precTaylor + 1, and we take a very crude bound here usinglog₂(n!) ≥ n - 1.
Equations
- One or more equations did not get rendered due to their size.