Approximations for Continued Fraction Computations (GenContFract.of
) #
Summary #
This file contains useful approximations for the values involved in the continued fractions
computation GenContFract.of
. In particular, we show that the generalized continued fraction given
by GenContFract.of
in fact is a (regular) continued fraction.
Moreover, we derive some upper bounds for the error term when computing a continued fraction up a
given position, i.e. bounds for the term
|v - (GenContFract.of v).convs n|
. The derived bounds will show us that the error term indeed gets
smaller. As a corollary, we will be able to show that (GenContFract.of v).convs
converges to v
in Algebra.ContinuedFractions.Computation.ApproximationCorollaries
.
Main Theorems #
GenContFract.of_partNum_eq_one
: shows that all partial numeratorsaᵢ
are equal to one.GenContFract.exists_int_eq_of_partDen
: shows that all partial denominatorsbᵢ
correspond to an integer.GenContFract.of_one_le_get?_partDen
: shows that1 ≤ bᵢ
.ContFract.of
returns the regular continued fraction of a value.GenContFract.succ_nth_fib_le_of_nthDen
: shows that then
th denominatorBₙ
is greater than or equal to then + 1
th fibonacci numberNat.fib (n + 1)
.GenContFract.le_of_succ_get?_den
: shows thatbₙ * Bₙ ≤ Bₙ₊₁
, wherebₙ
is then
th partial denominator of the continued fraction.GenContFract.abs_sub_convs_le
: shows that|v - Aₙ / Bₙ| ≤ 1 / (Bₙ * Bₙ₊₁)
, whereAₙ
is then
th partial numerator.
References #
- [Hardy, GH and Wright, EM and Heath-Brown, Roger and Silverman, Joseph][hardy2008introduction]
We begin with some lemmas about the stream of IntFractPair
s, which presumably are not
of great interest for the end user.
Shows that the fractional parts of the stream are in [0,1)
.
Shows that the fractional parts of the stream are nonnegative.
Shows that the fractional parts of the stream are smaller than one.
Shows that the integer parts of the stream are at least one.
Shows that the n + 1
th integer part bₙ₊₁
of the stream is smaller or equal than the inverse of
the n
th fractional part frₙ
of the stream.
This result is straight-forward as bₙ₊₁
is defined as the floor of 1 / frₙ
.
Next we translate above results about the stream of IntFractPair
s to the computed continued
fraction GenContFract.of
.
Shows that the integer parts of the continued fraction are at least one.
Shows that the partial numerators aᵢ
of the continued fraction are equal to one and the partial
denominators bᵢ
correspond to integers.
Shows that the partial numerators aᵢ
are equal to one.
Shows that the partial denominators bᵢ
correspond to an integer.
Creates the simple continued fraction of a value.
Equations
- SimpContFract.of v = ⟨GenContFract.of v, ⋯⟩
Instances For
Creates the continued fraction of a value.
Equations
- ContFract.of v = ⟨SimpContFract.of v, ⋯⟩
Instances For
One of our next goals is to show that bₙ * Bₙ ≤ Bₙ₊₁
. For this, we first show that the partial
denominators Bₙ
are bounded from below by the fibonacci sequence Nat.fib
. This then implies that
0 ≤ Bₙ
and hence Bₙ₊₂ = bₙ₊₁ * Bₙ₊₁ + Bₙ ≥ bₙ₊₁ * Bₙ₊₁ + 0 = bₙ₊₁ * Bₙ₊₁
.
Shows that the n
th denominator is greater than or equal to the n + 1
th fibonacci number,
that is Nat.fib (n + 1) ≤ Bₙ
.
As a simple consequence, we can now derive that all denominators are nonnegative.
Shows that all denominators are nonnegative.
Shows that bₙ * Bₙ ≤ Bₙ₊₁
, where bₙ
is the n
th partial denominator and Bₙ₊₁
and Bₙ
are
the n + 1
th and n
th denominator of the continued fraction.
Shows that the sequence of denominators is monotone, that is Bₙ ≤ Bₙ₊₁
.
Approximation of Error Term #
Next we derive some approximations for the error term when computing a continued fraction up a given
position, i.e. bounds for the term |v - (GenContFract.of v).convs n|
.
This lemma follows from the finite correctness proof, the determinant equality, and by simplifying the difference.
Shows that |v - Aₙ / Bₙ| ≤ 1 / (Bₙ * Bₙ₊₁)
.
Shows that |v - Aₙ / Bₙ| ≤ 1 / (bₙ * Bₙ * Bₙ)
. This bound is worse than the one shown in
GenContFract.abs_sub_convs_le
, but sometimes it is easier to apply and
sufficient for one's use case.