# Patterns appearing in irrational approximation graphs

I'd like to know more about some patterns I found in graphs corresponding to irrational numbers. Here's the graph for $\sqrt 2$ for example

First, I'll try to explain most naturally the function that generates this graph.

$\bullet\ \textbf{Explanation}$

Any irrational may be approximated as accurately as we wish by fractions. For example, here is a sequence of fractions that gets closer to $\sqrt{2}$

$$\frac{1}{1}\rightarrow\frac{3}{2}\rightarrow\frac{17}{12}\rightarrow\frac{577}{408}\rightarrow\ ...$$ This sequence is generated by applying Newton's method to $x^2-2=0$ (which, of course, is solved by $\sqrt{2}$). It's pretty accurate $$\sqrt 2 = 1.41421{\bf356}$$ $$\frac{577}{408}=1.41421{\bf568}...$$ $408$ seems to be special because the best approximation with a denominator of $408$ has $5$ correct decimal places. However the best approximation with a denominator of $407$ only has $2$ correct decimal places!

$$\frac{576}{407}=1.41{\bf523}...$$

I tried to generalize this idea of a denominator being "more fitting" to some particular irrational number.

For some denominator $d$, we say that the error between the best fractional approximation with denominator $d$ - disregarding the possibility of simplifying the fraction - and an irrational number $r$. I.e. $$\text{Error}_r(d):= \text{min}_n\big|\ \frac{n}{d}-r\ \big|$$ We now have

$$\text{# of correct digits} \approx -\text{log}(\text{Error}_r(d))$$ $$(\text{where "log" is base-}e)$$

A slight problem with this definition though is that bigger denominators inevitably all achieve smaller error than $408$. So we will enforce a "penalty" for big denominators so that numbers like $408$ remain "special". I've been calling one such function "Log-Error"

$$\text{LogError}_r(d):=-\frac{\text{log}(\text{Error}_r(d))}{1+\text{log(d)}}$$

The graph above is merely a scatter plot of this function for $1 \le d < 1000$

Here are the graphs for $e$, $\pi$, and $(19-\sqrt{3})^{1/4}$:

Oddly $\sqrt 2$ is the only irrational I've found that seems to have an increasing log-error function.

Any further info is appreciated. Specifically

For which numbers irrational numbers does the log-error have a global maximum?

Why do these patterns even appear in the first place?

Does Newton's method always generate numerator minimizing the error?

If so, are the fractions generated by Newton's method always local maxima of the log-error function?

• The general phenomenon you're seeing is related to continued fraction expansions of irrational numbers; these "strangely good" denominators are (part of) the convergents of the continued fraction expansion. – Ian Aug 22 '17 at 17:47