Graphing Continued Fractions of Quadratic Irrationals

​
a
1
c
1
b
2
d
1
S
5
1
2
+
5
{2,{1,2,1,3}}
Let
x=
a
b
+
c
d
S
,
a,b,c,d,S∈
. The continued fraction of
x
is either finite (when
S
is a perfect square so that
x
is rational) or eventually periodic (when
S
is not a perfect square so that
x
is irrational).
If
x
is rational, the elements of its continued fraction are plotted.
If
x
is irrational, let its continued faction be
x=[
x
0
;
x
1
,
x
2
,…,
x
m
,
x
m+1
,
x
m+2
,…,
x
m+n
]
, where the repeating part under the bar starts as soon as possible. In that case, the plot is of the repeating part
w={
x
m+1
,
x
m+2
,…,
x
m+n
}={
w
1
,
w
2
,…,
w
n
}
, with the initial elements
{
x
0
;
x
1
,
x
2
,…,
x
m
}
ignored.
Sometimes
w
is a palindrome; that is,
w
is the same read from right to left as from left to right,
{
w
n
,…,
w
2
,
w
1
}={
w
1
,
w
2
,…,
w
n
}
, and its graph is symmetric. Often
w
is the concatenation of two palindromes, like
1
3
+
5
3
=[1;
1,4,1,2,6,2
]
. If
r>1
is rational and not a perfect square, then
r
=[
x
0
;
x
1
,
x
2
,…,
x
2
,
x
1
,2
x
0
]
; that is,
w
is a palindrome concatenated with twice the integer part of
r
, which is a trivial palindrome. Finally, there are cases where
w
is not a palindrome. Colors distinguish the various cases.
The continued fraction is shown under the plot in the Mathematica notation
{
x
0
,
x
1
,…,
x
m
,{
x
m+1
,
x
m+2
,…,
x
m+n
}}
.

References

[1] E. R. Burger, "A Tail of Two Palindromes," The American Mathematical Monthly, 112, 2005 pp. 311–321. mathdl.maa.org/mathDL/22/?pa=content&sa=viewDocument&nodeId=3154.

External Links

Continued Fraction (Wolfram MathWorld)
Continued Fraction Approximations
Convergent (Wolfram MathWorld)

Permanent Citation

George Beck
​
​"Graphing Continued Fractions of Quadratic Irrationals"​
​http://demonstrations.wolfram.com/GraphingContinuedFractionsOfQuadraticIrrationals/​
​Wolfram Demonstrations Project​
​Published: July 17, 2012