continued fraction expansion
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)
complex number, RootOf representing one real number, rational function, or Laurent series
either s or s=a where s is a name and a is an algebraic expression
list of terms of a finite or periodic continued fraction expansion
natural number, range of natural numbers, or the symbol all
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
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
is represented in list form as
The different forms for continued fraction expansions:
Regular continued fraction:
where, usually, ai and bi for i > 0 are integers or polynomials with integer coefficients. If b0≠0 then it is called superdiagonal, otherwise it is called subdiagonal.
Simple continued fraction:
Simple regular continued fraction:
Semisimple continued fraction:
where ei=±1 and sign⁡bi=1 for all i.
Monic polynomial continued fraction:
where each bi is a monic polynomial for all i.
Periodic continued fraction:
cf := ContinuedFraction(Pi);
Digits := 200: evalf(abs(Value(ContinuedFraction((2))) - Pi)); Digits := 10:
cf := ContinuedFraction(sqrt(3));
Term(ContinuedFraction(35470/99661 + 315/99661*I), all, form = centered);
Term(ContinuedFraction((x^4 + 13*x^2 + 50*x + 120)/ (5*x^2 + x + 1)), all);
Term(ContinuedFraction((1+x)^k, x), 0..7, form = simple_regular, diagonal = sub);
Term(ContinuedFraction(exp(x), x = a), 0..5);
The NumberTheory[ContinuedFraction] command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
Download Help Document
What kind of issue would you like to report? (Optional)