Continued Fraction Expansion - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


NumberTheory

  

ContinuedFraction

  

continued fraction expansion

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

ContinuedFraction(ex)

ContinuedFraction(cf_list)

ContinuedFraction(ex, v)

ContinuedFraction(cf_list, v)

Term(cf, n, form = formopt, diagonal = diagopt)

Convergent(cf, m, form = formopt, diagonal = diagopt)

Numerator(cf, m, form = formopt, diagonal = diagopt)

Denominator(cf, m, form = formopt, diagonal = diagopt)

Value(cf)

Parameters

ex

-

complex number, RootOf representing one real number, rational function, or Laurent series

v

-

either s or s=a where s is a name and a is an algebraic expression

cf_list

-

list of terms of a finite or periodic continued fraction expansion

cf

-

ContinuedFraction object

m

-

natural number, range of natural numbers, or the symbol all

n

-

natural number, range of natural numbers, or one of the symbols all or periodic

form = formopt

-

(optional) keyword argument where formopt is one of simple, regular, centered, monic, simple_regular, or semisimple

diagonal = diagopt

-

(optional) keyword argument where diagopt is one of super or sub

Description

• 

The ContinuedFraction function returns an object which represents a continued fraction expansion depending on ex and v.

• 

For ContinuedFraction(ex), the value represented by the returned object depends on ex. If ex is a complex number, a rational function in one variable, or a Laurent series, then ex is represented exactly. An error message is displayed if any other type of value is given.

• 

For ContinuedFraction(cf_list), if cf_list is a list of two elements where the first element is a list of integers and the second element is a list of positive integers, then cf_list is interpreted as representing a periodic expansion, where the first list is the pre-periodic part and the second list is the periodic part. Otherwise, cf_list is interpreted as a finite expansion and the exact value is represented.

• 

For ContinuedFraction('ex', 'v') and ContinuedFraction('cf_list', 'v'), the interpretation of ex depends on v. If v is a name, then ex is a rational function in v, if possible and otherwise the returned object represents the Laurent series expansion of ex expanded at v=0. If v is an equation s=a, then the value represented is the Laurent series expansion of ex at s=a.

• 

The Term command returns terms of the continued fraction cf.

– 

If n is a range a..b, then Term returns the terms with indices a..b. The return value is always a list in this case and if the indices exceed the available terms in a finite expansion, then NULL is used to fill their place.

– 

If n is a number, then Term returns the term with index n. If n exceeds the available terms, then an error message is displayed.

– 

If n is all, then Term returns all terms if the expansion is finite.

– 

If n is periodic, then Term returns the periodic expansion if cf represents a real quadratic surd.

• 

If cf represents a complex number, then formopt can be one of simple or centered, where simple is the default. If cf represents a rational function, then formopt can be one of simple, regular, or monic, where simple is the default. If cf represents a series, then formopt can be one of simple, regular, simple_regular, or semisimple, where regular is the default.

• 

The diagonal option is valid only when cf represents a series. The default is super.

• 

The commands Convergent, Numerator, and Denominator return, respectively, a convergent, the numerator of a convergent, and the denominator of a convergent. Their arguments follow the same rules as the arguments of Term except when m is a number. For a finite continued fraction, the sequence of convergents is infinite where after some finite number of initial terms in the sequence, every term thereafter is equal to the value represented by the continued fraction.

• 

The Value command returns the exact value represented by cf.

• 

A continued fraction

b0+a1b1+a2b2+......+anbn+...

  

is represented in list form as

b0,a1,b1,a2,b2,...,an,bn,...

• 

The different forms for continued fraction expansions:

1. 

Regular continued fraction:

b0,a1,b1,a2,b2,...,an,bn,...

  

where, usually, ai and bi for i > 0 are integers or polynomials with integer coefficients. If b00 then it is called superdiagonal, otherwise it is called subdiagonal.

2. 

Simple continued fraction:

a0,a1,a2,...,an,...=a0,1,a1,1,a2,...,1,an,...

3. 

Simple regular continued fraction:

b0,a1,1,a2,1,...,an,1,...

4. 

Semisimple continued fraction:

b0,e1,b1,e2,b2,...,en,bn,...

  

where ei=±1 and signbi=1 for all i.

5. 

Monic polynomial continued fraction:

b0,e1,b1,e2,b2,...,en,bn,...

  

where each bi is a monic polynomial for all i.

6. 

Periodic continued fraction:

a0,...,am,b0,...,bn=a0,...,am,b0,...,bn,b0,...,bn,...

Examples

withNumberTheory:

cfContinuedFractionπ

cf3+17+115+11+1292+11+11+11+12+11+

(1)

Termcf,0..100

3,7,15,1,292,1,1,1,2,1,3,1,14,2,1,1,2,2,2,2,1,84,2,1,1,15,3,13,1,4,2,6,6,99,1,2,2,6,3,5,1,1,6,8,1,7,1,2,3,7,1,2,1,1,12,1,1,1,3,1,1,8,1,1,2,1,6,1,1,5,2,2,3,1,2,4,4,16,1,161,45,1,22,1,2,2,1,4,1,2,24,1,2,1,3,1,2,1,1,10,2

(2)

Digits200:evalfabsValueContinuedFractionπ;Digits10:

2.27286794373942716879912269871874593270206667615219263136362270252567582047192090135453196247894×10−104

(3)

Termcf,4

292

(4)

cfContinuedFractionsqrt3

cf1+11+12+11+12+11+12+11+12+11+

(5)

Termcf,periodic

1,1,2

(6)

ValueContinuedFraction

3

(7)

TermContinuedFraction3547099661+31599661I,all,form=centered

0,I,3I,1,1+5I,−1,2+I,I,1+2I,−I,3+2I,−I,1+I

(8)

TermContinuedFractionx4+13x2+50x+1205x2+x+1,all

15x2125x+321125,625x5934281087511737452,23216680056x14242671875+5743135263614242671875

(9)

TermContinuedFraction1+xk,x,0..7,form=simple_regular,diagonal=sub

0,1,1,kx,1,k+1x2,1,k1x6,1,k+2x6,1,k2x10,1,k+3x10,1

(10)

TermContinuedFractionexpx,x=a,0..5

ⅇa,xa,1ⅇa,xa,2ⅇa,xa,3ⅇa,xa,2ⅇa,xa,5ⅇa

(11)

Compatibility

• 

The NumberTheory[ContinuedFraction] command was introduced in Maple 2016.

• 

For more information on Maple 2016 changes, see Updates in Maple 2016.

See Also

convert/confrac

NumberTheory

NumberTheory[ContinuedFractionPolynomial]