Real.log extension for tactic dyadic_interval #
This file implements Real.log extension for the tactic dyadic_interval.
Implementation notes #
We first define Inclusion.IntervalDyadicReal.smallArtanh, which computes artanh of a small
rational number num / den using the binary splitting method. Then we use the identity
log 2 = 6 * artanh (1 / 17) + 4 * artanh (1 / 19) + 4 * artanh (1 / 31)
to obtain a dyadic approximation of log 2.
With these, log x is computed for arbitrary x by first bringing |x| into the interval
[1, 2) (writing x = x' * 2 ^ k with |x'| ∈ [1, 2)) and then adding k * log 2; this keeps
the argument of the series small, so that it converges quickly.
We use artanh rather than log itself because all the terms of its series are positive (for a
positive argument). Hence every truncated partial sum is a lower bound, and an upper bound is
obtained by adding a step prec.
References #
The n-th partial sum of the artanh series at num / den,
returned as (P, Q) with P / Q equal to this sum.
Note that the series converges slowly when the input is close to 1.
Equations
- Inclusion.IntervalDyadicReal.smallArtanh num den n = have r := Inclusion.IntervalDyadicReal.smallArtanh.go num den 0 n; (num * r.2.2, den * r.2.1)
Instances For
Binary splitting auxiliary function: go a b returns (P, Q, R) on segment [a, b).
R is the numerator of ∑ k ∈ Finset.Ico a b, ∏ j ∈ Finset.Ico a k, t (j + 1) / t j put over
the common denominator of the term ratios ((2 * k + 1) * num ^ 2) / ((2 * k + 3) * den ^ 2).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The partial sums computed by smallArtanh are lower bounds for artanh (num / den).
An upper bound for artanh (num / den) in terms of the partial sums computed by
smallArtanh.
Computes a lower bound for log x with precision prec.
Equations
- One or more equations did not get rendered due to their size.
- Inclusion.IntervalDyadicReal.lowerLog Dyadic.zero prec = 0