Graphing Continued Fractions of Quadratic Irrationals
Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
Let , . The continued fraction of is either finite (when is a perfect square so that is rational) or eventually periodic (when is not a perfect square so that is irrational).[more]
If is rational, the elements of its continued fraction are plotted.
If is irrational, let its continued faction be , where the repeating part under the bar starts as soon as possible. In that case, the plot is of the repeating part , with the initial elements ignored.
Sometimes is a palindrome; that is, is the same read from right to left as from left to right, , and its graph is symmetric. Often is the concatenation of two palindromes, like . If is rational and not a perfect square, then ; that is, is a palindrome concatenated with twice the integer part of , which is a trivial palindrome. Finally, there are cases where is not a palindrome. Colors distinguish the various cases.
The continued fraction is shown under the plot in the Mathematica notation .[less]
Contributed by: George Beck (July 2012)
Open content licensed under CC BY-NC-SA
 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.