Fractals/Continued fraction

From testwiki
Revision as of 19:12, 10 July 2023 by imported>Soul windsurfer (How to use it in computer programs: * decimal number ( real or rational) to continued fraction ** [https://foo123.github.io/examples/abacus/ abacus CAS ] ** Maxima CAS : cf (expr) Converts expr into a continued fraction.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
            "Do not worry about your problems with mathematics, I assure you mine are far greater." Albert Einstein

Notation

Generalized form

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

a0+b1a1+b2a2+b3a3+

where :

  • an and bn are either integers, rational numbers, real numbers, or complex numbers.
  • a0, a1 etc., are called the coefficients or terms of the continued fraction

Variants or types :

  • If bn=1 for all 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
 a0  2 All integers are a degenerate case
 a0+1a1  2+13 Simplest possible fractional form
 a0+1a1+1a2  3+12+118 First integer may be negative
 a0+1a1+1a2+1a3  115+11+1102 First integer may be zero

simple form

It is generally assumed that the numerator b of all of the fractions is 1. Such form is called a simple or regular continued fraction, or said to be in canonical form.

If real number is a fraction ( x < 1), then a0 is zero and the notation is simplified:

  [0;a1,a2,a3]=[a1,a2,a3]

Finite

Notation :

 a0+1a1+1a2+1a3=[a0;a1,a2,a3]

Every finite continued fraction represents a rational number pq:

  pq=a0+1a1+1a2+1a3=[a0;a1,a2,a3]

If positive real fraction x is rational number, there are exactly two different continued fraction expansions:

  [a1,a2,a3,...,an]=[a1,a2,a3,...,an1,1]

where

  • an>1
  • Usually the first, shorter form is chosen as the canonical representation
  • second form is one longer then the first

Infinite

Notation :

 a0+1a1+1a2+1a3+=[a0;a1,a2,a3,]

Every infinite continued fraction is irrational number α :

 α=a0+1a1+1a2+1a3+=[a0;a1,a2,a3,]

The rational number pnqn obtained by limited number of terms in a continued fraction is called a n-th convergent

  pnqn=a0+1a1+1a2+1a3+1+1an=[a0;a1,a2,a3,,an]

because sequence of rational numbers pnqn converges to irrational number α

 limnpnqn=α

In other words irrational number α is the limit of convergent sequence.

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

pn=anpn1+pn2
qn=anqn1+qn2

so

pnqn=anpn1+pn2anqn1+qn2



Key words :

  • the sequence of continued fraction convergents pnqn of irrational number α
  • 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

  • decimal number ( real or rational) to continued fraction
    • abacus CAS
    • Maxima CAS : cf (expr) Converts expr into a continued fraction.

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]


Help

See also


References

Template:BookCat