Fractals/Continued fraction

            "Do not worry about your problems with mathematics, I assure you mine are far greater." Albert Einstein


Notation

A continued fraction[1] is an expression of the form

${\displaystyle a_{0}+{\cfrac {b_{1}}{a_{1}+{\cfrac {b_{2}}{a_{2}+{\cfrac {b_{3}}{a_{3}+{_{\ddots }}}}}}}}}$

where :

• ${\displaystyle a_{n}}$  and ${\displaystyle b_{n}}$  are either integers, rational numbers, real numbers, or complex numbers.
• ${\displaystyle a_{0}}$ , ${\displaystyle a_{1}}$  etc., are called the coefficients or terms of the continued fraction

Variants or types :

• If ${\displaystyle b_{n}=1}$  for all ${\displaystyle n}$  the expression is called a simple continued fraction.
• If the expression contains a finite number of terms, it is called a finite continued fraction.
• If the expression contains an infinite number of terms, it is called an infinite continued fraction.[2]

Thus, all of the following illustrate valid finite simple continued fractions:

Examples of finite simple continued fractions
Formula Numeric Remarks
${\displaystyle \ a_{0}}$  ${\displaystyle \ 2}$  All integers are a degenerate case
${\displaystyle \ a_{0}+{\cfrac {1}{a_{1}}}}$  ${\displaystyle \ 2+{\cfrac {1}{3}}}$  Simplest possible fractional form
${\displaystyle \ a_{0}+{\cfrac {1}{a_{1}+{\cfrac {1}{a_{2}}}}}}$  ${\displaystyle \ -3+{\cfrac {1}{2+{\cfrac {1}{18}}}}}$  First integer may be negative
${\displaystyle \ a_{0}+{\cfrac {1}{a_{1}+{\cfrac {1}{a_{2}+{\cfrac {1}{a_{3}}}}}}}}$  ${\displaystyle \ {\cfrac {1}{15+{\cfrac {1}{1+{\cfrac {1}{102}}}}}}}$  First integer may be zero

simple continued fractions

Finite

Notation :

 ${\displaystyle a_{0}+{\cfrac {1}{a_{1}+{\cfrac {1}{a_{2}+{\cfrac {1}{a_{3}}}}}}}=[a_{0};a_{1},a_{2},a_{3}]}$


Every finite continued fraction represents a rational number ${\displaystyle {\frac {p}{q}}}$ :

  ${\displaystyle {\frac {p}{q}}=a_{0}+{\cfrac {1}{a_{1}+{\cfrac {1}{a_{2}+{\cfrac {1}{a_{3}}}}}}}=[a_{0};a_{1},a_{2},a_{3}]}$


Infinite

Notation :

 ${\displaystyle a_{0}+{\cfrac {1}{a_{1}+{\cfrac {1}{a_{2}+{\cfrac {1}{a_{3}+{\ddots }}}}}}}=[a_{0};a_{1},a_{2},a_{3},\ldots ]}$


Every infinite continued fraction is irrational number ${\displaystyle \alpha }$  :

 ${\displaystyle \alpha =a_{0}+{\cfrac {1}{a_{1}+{\cfrac {1}{a_{2}+{\cfrac {1}{a_{3}+{\ddots }}}}}}}=[a_{0};a_{1},a_{2},a_{3},\ldots ]}$


The rational number ${\displaystyle {\frac {p_{n}}{q_{n}}}}$  obtained by limited number of terms in a continued fraction is called a n-th convergent

  ${\displaystyle {\frac {p_{n}}{q_{n}}}=a_{0}+{\cfrac {1}{a_{1}+{\cfrac {1}{a_{2}+{\cfrac {1}{a_{3}+{\cfrac {1}{{\ddots }+{\cfrac {1}{a_{n}}}}}}}}}}}=[a_{0};a_{1},a_{2},a_{3},\ldots ,a_{n}]}$


because sequence of rational numbers ${\displaystyle {\frac {p_{n}}{q_{n}}}}$  converges to irrational number ${\displaystyle \alpha }$

 ${\displaystyle \lim _{n\rightarrow \infty }{\frac {p_{n}}{q_{n}}}=\alpha }$


In other words irrational number ${\displaystyle \alpha }$  is the limit of convergent sequence.

Nominator p and denominator q can be found using the relevant recursive relation:

${\displaystyle p_{n}=a_{n}p_{n-1}+p_{n-2}}$
${\displaystyle q_{n}=a_{n}q_{n-1}+q_{n-2}}$

so

${\displaystyle {\frac {p_{n}}{q_{n}}}={\frac {a_{n}p_{n-1}+p_{n-2}}{a_{n}q_{n-1}+q_{n-2}}}}$

Key words :

• the sequence of continued fraction convergents ${\displaystyle {\frac {p_{n}}{q_{n}}}}$  of irrational number ${\displaystyle \alpha }$
• sequence of the convergents
• continued fraction expansion
• rational aproximation of irrational number
• a best rational approximation to a real number r by rational number p/q

How to use it in computer programs

Maxima CAS

In Maxima CAS one have cf and float(cfdisrep())

(%i2) a:[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
(%o2) [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
(%i3) t:cfdisrep(a)
(%o3) 1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/(1+1/1))))))))))))))))))))))
(%i4) float(t)
(%o4) 0.618033988957902


To compute n-th convergent:

(%i10) a;
(%o10) [0, 3, 2, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
(%i11) a3: listn(a,3);
(%o11) listn([0, 3, 2, 1000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1], 3)
(%i12) a3: firstn(a,3);
(%o12)                             [0, 3, 2]
(%i13) cf3:cfdisrep(a3);
1
(%o13)                               -----
1
3 + -
2
(%i14) r3:ratsimp(cf3);
2
(%o14)                                 -
7
(%i15)


Examples

• number theory
• continued fractions based functions over the complex plan[3][4]
• " a continued fraction may be regarded as a sequence of Möbius maps" Alan F. Beardone[5]