Talk:Continued fraction/Archive 1

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Old comments

According to the quite long tradition in number theory notation for a continued fraction is in between < and > brackets, so I do belive there's no need useing [ and ] brackets.
XJam [2002.04.02] 2 Tuesday (0)

I have seen brackets more often. I don't think it makes much of a difference though. AxelBoldt


I can barely follow this page. Firstly, the way it reads, it says that by choosing suitable values, a fraction can be made to equal or at least approach any number. So what? It is in no way clear as to how these numbers are chosen, and the demonstration of finding a series that converges on Pi makes no sense at all. It's like something is being assumed in the discussion that I'm not privy to. Also I wonder if anyone could add to it and say why the theorem was created in the first place - what problem did it solve?

As a minor contributor to this page, I decide to attempt a response to the comment above. A continued fraction is just another way to represent a number - on a par with the decimal system or Egyptian fractions. There is a clearly defined way to calculate the elements an in the continued fraction representation of any given number; this method is demonstrated in the π example, but it might help if the article explained it more directly. The continued fraction representation for some numbers is finite; for others it is infinite. The continued fraction representation for some numbers exhibits a pattern; for others it is apparently random. Continued fractions are of interest to mathematicians because they arise in the Euclidean algorithm for finding the greatest common denominator of two numbers, and they can be used to find the "best" rational approximations to a given number (this is mentioned in the π example, but again could perhaps be made clearer). Gandalf61 13:23, May 18, 2004 (UTC)
I agree that the page needs some better explanation for the general reader. A lot of wikipedia's math articles explain the what but not the why. I will try to add some better explanation this week. -- Dominus 14:16, 18 May 2004 (UTC)
I have added a section that tries to explain why continued fractions are considered to be interesting. -- Dominus 15:10, 18 May 2004 (UTC)

It looks like there's an error in the "Infinite continued fractions" section. The final step listed seems to be missing an a0 from the pn-1 generation. I think the real sequence should be the following:

Anyone else agree? -- Rckenned 15:41, 14 Jul 2004 (UTC)

I agree - and I have fixed it. Gandalf61 16:33, Jul 14, 2004 (UTC)
Seems that it is not totally fixed: the recursive formulae for h_n and k_n are wrong. The h_{n-1} and k_{n-1} need to be exchanged. Dscho 16:44, 8 Jun 2005 (UTC)

Looking a bit bare

The page seems to be missing a lot of fundamental theorems to continued fractions and continued fraction expansions. I will try my best over the upcoming Easter holiday to get my notes out and starting putting some useful ones up (and some of the proofs if they are small enough). Also it is very much lacking examples and approaches to finding continued fractions, I will try my best to add some of these as well. Can anyone think of anything else that needs adding? Because I just finished a course in this so a lot of the material is fresh in my mind. zurtex

Need for an expanded definition

A few comments.

The definition of continued fractions here is too narrow. First of all, continued fraction theory is divided into analytic and arithmetic theory. The entry here is devoted entirely to arithmetic theory. In analytic theory, which is the focus of about half of the research, the numerators are not confined to being one. In fact, it is best to consider a continued fraction to be a formal expression of indeterminates (with numberator and denominator indeterminates.) For an infinite continue fraction, the indeterminates are taken in a complete normed field so that convergence can be defined. Continued fractions with elements from p-adic fields, formal Laurent series fields etc, have all been considered. These all fall outside of even the analytic and arithmetic categories I have mentioned above. With just formal indeterminates, continued fractions are even studied combinatorially. See the work of Flajolet, for example. BTW, for information purposes, I will mention that analytic theory refers to complex analysis, that is, calculus in the complex plane. So in this HUGE area of research, the elements of the continued fractions are assumed to be complex numbers. (Indeed, continued fractions are often viewed as products of fractional linear transformations, which are beautifully understood in the context of the complex plane.)

The associated entry on "generalized continued fractions" is even more naive. The expressions there are what are generally refered to as continued fractions, only the elements of the expression are not confined to being integers; indeed even in some of the examples given, for instance for exp(x), x is given as being complex, contraticting the earlier statement that the elements of the continued fraction being integers. I could go on about that entry, but I wont. Suffice it to say that today in mathematics, generalized continued fractions refer to several different things, among them: matrix continued fractions-- see the work of Levrie, and branched or branching continued fractions.

I wish I had time to write a complete entry on continued fractions, but I do not.

Here are some book suggestions for those enthusiastic about updating this entry. PLEASE have a look at the following books:

The best reference on the subject is:

1) "Continued Fractions with Applications", by Lisa Lorentzen and Haakon Waadeland, North Holland, 1992. (This covers analytic theory and a bit of arithmetic theory.)

On the arithmetic side, a great reference is:

2) "Continued Fractions" by Andrew M. Rockett and Peter Szusz. World Scientific, 1992. (This is a relatively up-to-date treatment of arithmetic theory.)

Older but good references are:

3) "Continued Fractions Analytic Theory and Applications", by William B. Jones and W.J. Thron. Addison-Wesley, 1980. (Analytic theory and history covered here.)

4) "Analytic Theory of Continued Fractions" by H.S. Wall. Chelsea, 1973. (Analytic theory).

5) "Die Lehre Von Den Kettenbruchen" Band I, II, by Oskar Perron, B.G. Teubner, 1954. (These two volumes cover both analytic and arithmetic theory and were written by the world's foremost expert on continued fractions of that day, also, I might add, a mathematician of great renown.)

Well, take care all. I am happy that people have taken the trouble to write an entry in wikipedia on continued fractions, a subject that has been near and dear to my heart for over 26 years.

Hi, yes,I agree the definition should be expanded. And several more quick remarks:
  • Please sign & date, don't post anonymously.
  • If this has really been near-n-dear for 26 years, surely you have a few hours to spare for your true love?
  • I'll copy the references over.

linas 03:22, 5 Jan 2005 (UTC)


Sorry for not signing or dating my comment.

I am q-analogue on Wikipedia. The date of my comment was (I believe Jan 4 2005).

To write up a full encyclopediac entry would take me, I believe, about 2 hours a day for a month or so. This is because the field is vast and certain parts technical. To work in the gradation from elementary description (usefull to most wikipedia users) to full technical coverage would be a big undertaking. Another obsticle is that I am not familiar with how to "typset" within the software of Wikipedia. Indeed, it took me the better part of 15 minutes to figure out how to put in my first comments. Maybe I need to look at the tutorials again, its been a few months. Anyway, I am certainly willing to help on this entry and would like to see it improved. Continued fractions are a great entry point into mathematical discovery and research, they are at once elementary enough that they can be understood by many people, while at the same time there are still a ton of unsolved problems about them vexing professional mathematicians today. Also, they have applications to a great many applied subjects.

Anyway, I would be happy to devote a few hours to this entry. I'm just not sure how to do that....

q-analogue

Jan 5, 2005

wormarmalade@gmail.com


Hi q-analogue.

I'll pitch in here. I wrote most of generalized continued fraction. I'm sure that anything you write will be of value. Just write what you want to, and if it's not brilliant prose (or probably even if it is!), wikipedians such as myself and linas will rehash it and revise it. Don't worry about formatting. Noone will mind if things aren't quite right.

Don't worry about any of your writing having bits missing, and don't worry about not writing a perfectly formed mathematical treatise off the bat. Just write a little bit and see what happens. Be bold! The beauty of wiki is that someone will fill in the bits. Just write what you want, when you get a minute.

(you can sign of with four tildes together to datestamp your comments).

best

Robinh 13:36, 5 Jan 2005 (UTC)


Hi, that sounds good to me.

I'll start with the usual definitions. I am used to useing LaTeX, so my mathematics will be in that form. Hope someone can read it. I will put side comments, not part of the article, in double parentheses which will contain further information that needs to be linked in, etc, or stuff I don't know how to do with the wiki format or html, or just comments on what I write.

A continued fraction is an expression of the form

(*) b_0 + \frac{a_1}{b_1 + \frac{a_2}{b_2+\frac{a_3}{b_3+\dots}}},

((Notes: The expression requires an equation number in place of the (*) I have used. Also, in the articles so far you have a_i=1 and b_i = a_i in my expression. Some books do this, but the case b_i=1 occurs just as often in continued fractions, and having the a's and b's inverted looks strange to the eye. The way I have written it is predominant.))

where the sequences \{a_i\} and \{b_i\} are usually taken to be elements of a field ((link to wikipedia article defining fields)), or are taken to be inderminates. Usually, the field is assumed to be complete ((wiki link needed)) and equipped with a norm ((wiki link needed)). In most cases, the sequences are complex numbers. ((wiki link needed)). The sequences \{a_i\} and \{b_i\} are refered to as the elements of the continued fraction (*).

Regular or simple continued fractions are the case in which a_i=1 and the b_i are natural numbers, with the exception of b_0, which is allowed to be 0.

((Note, the article on cfs so far in wiki is really about regular continued fractions.))

There exists a considerable body of research on how to give meaning to (*). The standard approach is to define the sequence of approximants \{f_n\} to (*) to be the rational functions ((wiki link needed))

(**) f_n= b_0 + \frac{a_1}{b_1 + \frac{a_2}{b_2+\frac{a_3}{b_3+\dots \frac{a_n}{b_n}}}}.

The continued fraction (*) is then said to converge if \lim_{n\to\infinity} f_n exists. When this limit exists, it is defined to be the value of the continued fraction (*). A more encompassing defintion of convergence in the case of complex elements was given by Lisa Lorentzen (ne Jacobsen) in 1986 who created the idea of general convergence of continued fractions. ((Her seminal paper "General convergence for continued fractions" was published in Transactions of the American Mathematical Society in Volume 294, no 2, pages 477-485. Her name on the paper is Lisa Jacobsen.))

An expression such as the right hand side of (**) is usually refered to as a finite continued fraction.

((Well, that covers the basic defintions with the exception of convergents. I'll try to add more in a bit.))


q-analogue Q-analogue 21:42, 5 Jan 2005 (UTC)


Couple of quick notes.

Diagonal dots should be used in place of \dots. Also, for regular continued fractions, b_0 is allowed to be negative when one is considering the regular continued fractions of negative real numbers.

q-analogue Q-analogue 21:52, 5 Jan 2005 (UTC)



A note on a topic of brackets for regular continued fractions. Square brackets are indeed more usual in publications today. Just look at a few issues of the Journal of Number Theory or Acta Arithmeticae. Angle brackets are used, but they are in the minority.

Q-analogue 09:17, 6 Jan 2005 (UTC)


Gandalf claims that 3.245 is [ 3 ; 4 , 12 , 4]

While I claimed that 3.245 is [ 3 ; 4 , 12 , 4, 1]

Can someone please resolved this dispute.

Please ignore this. I did the calculations myself and Gandalf was right and I was wrong. [ 3 ; 4 , 12 , 4] = 649/200 = 3.245 exact [ 3 ; 4 , 12 , 4, 1] = 808/249 = 3.24497992

Ohanian 23:49, 2005 Apr 5 (UTC)


Is there an algorithm for converting continued fractions into fractions?

For example: [ 3 ; 4 , 12 , 4 ] -> 649/200

The reason I asked is that I wanted to do addition, subtraction , multiplication and division with continued fractions.
Ohanian 05:06, 2005 Apr 6 (UTC)

There is such an algorithm, but you can do arithmetic on continued fractions without first turning them into fractions. I have been meaning to write a Wikipedia article about this for some time. Until then, you could take a look at [Arithmetic With Continued Fractions], which also has references to more detailed explanations. Dominus 16:02, 6 Apr 2005 (UTC)

(1) Let be a rational number. ie
(2) Let be a different rational number.
(3) Let be related to by an integer value
(3)+(2)
(4)
(5) Let be integer value of ie. if
(1) + (4) (6)
(1) + (4)
(7)
(6) + (7)
(8)
(2) + (7) + (8) (9)

This then leads to a recursive algorithm of turning a rational number (649/200) into continued fraction [3;4,12,4] by recursively calculating P using (5) and the new value of X using (9).

Ohanian 08:57, 2005 Apr 14 (UTC)


More fun with continued fractions of

The continued fractions of is

[3; 7, 15, 1, 292, 1, 1, 1, 2, 1, ... ]

I notice that the good rational representation of the continued fractions of are those just before a term of a large number. For example just before 292.

[3; 7, 15, 1 ] = 355/113

So I wanted to find where (which terms) the large numbers are in the continued fraction terms of

So far, my python program returns....

$ python pi.py
=======================================
Calculating the terms of pi using 4/pi = [(1,1),(3,4),(5,9),(7,16), ... ]
New record  3  at  0  term
New record  7  at  1  term
New record  15  at  2  term
New record  292  at  4  term
New record  436  at  307  term
New record  20776  at  431  term
New record  78629  at  28421  term
New record  179136  at  156381  term
New record  528210  at  267313 term
New record  12996958  at  453293 term

Ohanian 03:58, 2005 Apr 17 (UTC)

I believe it is still an open question whether the terms in the regular continued fraction for pi are bounded. It looks from your computation that they are unbounded. A close compadre of pi is e, which has a very nice regular continued fraction, whose terms are clearly unbounded. I wonder whether Euler's constant is like pi. Scott Tillinghast, Houston TX 21:08, 6 April 2007 (UTC)

Simple and not simple

Please expand on the simple continued fraction (unity numerators) to include non unity numerators.

Check out Generalized continued fraction.--Niels Ø 19:47, May 23, 2005 (UTC)


Arithmetic sequences

Are there any formulas for the continued fractions when the numbers are in a special sequence such as a Arithmetic progression or Geometric progression (Examples: [0;1,2,3,...],[1;2,4,8,...])?--SurrealWarrior 03:16, 14 Jun 2005 (UTC)

According to Richard Schroeppel in HAKMEM, when the terms of the continued fraction are an arithmetic sequence, say [a+d, a+2d, a+3d, ...], the value of the fraction is
,
where the I(x) are modified Bessel functions. Hope this helps! -- Dominus 13:29, 14 Jun 2005 (UTC)

Thanks--SurrealWarrior 19:34, 14 Jun 2005 (UTC)

Mistakes in article

When I was to translate it to chinese, I spotted some strange lines.

Under theorem 3 reads

Corollary 1: Each convergent is in its lowest terms (for if and had a common divisor it would divide , which is impossible).

What is the q_n? Is it a typo?

Theorem 4 Each convergent is nearer to the nth convergent than any of the preceding convergents. In symbols, if the rth convergent is considered to , then

for all

What does "considered to" means exactly? And should there be a condition that r,s<n?

I suspect there are more mistakes in the article, but I've forgotten all about the continued fractions. So please can anyone proofread it? --Small potato 30 June 2005 13:47 (UTC)

General comments

"Longer expressions are defined analogously." Second sentence. It looks to me that the scheme already suggests an infinitely long expression.

I think that the article is becoming inconsistent. For example, Theorem 1... x represents any real, but in the lead paragraph the cascade of denominators (of which x is one) is to consist of positive integers. And I think that "x" to this point has had a special meaning, namely, it's the number which is generating the fraction. A symbol other than x (like "k") would perhaps be better, and I believe that having "it" be a positive integer suffices both for consistency and the generality of the result. For consistency, the first comma should be a semicolon ... [a_0; a_1, ... ]

Theorem 4, I think, needs some work. Again, "x" seems to represent a fixed quantity generating the continued fraction in most of the article. To me, this meaning for "x" is necessarily what the Corollaries to Theorem 4 are referring to... if you think about an infinite continued fraction with the convergents see-sawing above and below x (this being the limit and number that has generated the fraction) and gradually converging to x (and only x), then this interpretation of x is the only one which makes the corollaries true as written. So, the choice of the letter x to represent something else in this theorem and the corollaries is perhaps unfortunate on the one hand, and leads to falsehood on the other (unless the fraction is a finite one, terminating with the quotient a_n).

(Thinking out loud for a minute... I'm not sure yet that Theorem 4 is true, for either interpretation of "x". Supposing the "x" means the limiting value (= the number generating the infinite continuing fraction = the continuing fraction)... one may approach a value in a see-saw fashion without having the "too small and getting bigger" things related much to the "too big and getting smaller" things in terms of closeness to the limiting value... though some of the inequalities may have implications I don't yet see. That is... in principle at least... even if the convergents are getting closer to one another, they may be approaching the limit in a rather lopsided fashion... with "see"-ing being far more pronounced than "saw"-ing, to continue the visual metaphor. For the other meaning of "x", I'm not sure either. One meaning may be true, one false. I'll have to really think about this, of course. As for this thinking... it seems to me that Theorem 5 has considerable bearing, and in fact Theorem 5 might be better placed before Theorem 4.)

I've added the word "nontrivial" to the parenthesized proof of Corollary 1 to Theorem 3... I don't think this is controversial.

I'm not following the text for Semiconvergents at all (but the concept is interesting). What exactly is to be between what? I would guess that ... the semiconvergent fraction, the one involving the a's, is to be between the successive convergents, the ones explicitly mentioned. What exactly is being claimed ... what exactly is the theorem?

Pell's equation... no, p=1 and q=0 is a solution. I'll need to think before editing this, for now I'll just edit to indicate both p and q are positive.

I've noted that there are actually four, rather than three, convergents displayed in the Infinite Continued Fractions section, and that these may be considered numbers 0, 1, 2, and 3.

(I've returned to this to edit, expand, and tidy up some grammar... Mathguy2, later in the day, Nov 5 2005)

Mathguy2 20:08, 5 November 2005 (UTC)

History of continued fractions

Can someone supply a brief section on the history of continued fractions?--Niels Ø 16:24, 19 February 2006 (UTC)

Examples of periodic cont'd fractions

I think an example like sqrt(13)=[3;1,1,1,1,6,1,1,1,1,6,...] or sqrt(14)=[3;1,2,1,6,1,2,1,6,....] would better illustrate what "periodic" means.

Simple continued fraction

Shouldn't the name of this article be Simple continued fraction? Since this type of continued fraction is only one of many forms of continued fraction. Please refer to http://mathworld.wolfram.com/ContinuedFraction.html.

Overly restrictive definition

I've read through the discussion of this page, and I notice that "q-analogue" has already pointed this out. The definition of a continued fraction in this article is ridiculously restrictive. I imagine that whoever set this up in the first place wanted to avoid dealing with the very messy problem of convergence – that's a lot tougher than dealing with the convergence of series, especially when the cf is taken over the complex numbers.

Anyway, I'm intending to fix this definition fairly soon, and also in the associated article generalized continued fraction. I want to add more content about continued fractions, and I really think the definition in this article has to be fixed, or future authors won't be able to build on it. DavidCBryant 12:52, 30 November 2006 (UTC)

AFAIK, the definition given in this article (in which the co-efficients are restricted to positive integers) is the standard definition in number theory for a simple continued fraction. Although the concept of a continued fraction can clearly be extended in various ways, we do need to be careful that when we use terms in Wikipedai we use them with their usual meanings. If you intend to extend or change the definition given in this article, please cite sources for your new definition, so we can be sure it is not original research. Gandalf61 15:47, 30 November 2006 (UTC)
Citing a few references is not enough to justify changing the definition. I think the article should have a sort of disambiguation near the top, pointing out that "continued fraction" has several more-or-less restrictive/inclusive meanings in different mathematical fields, and pointing the reader to the article covering the desired meaning. Then, this article should go on to describe the most common meaning.--Niels Ø 18:13, 30 November 2006 (UTC)

Well, I also kicked this around a bit over on the Wikiproject:Mathematics page, and everybody seems to feel the same way. So all I've done to this definition is insert the word "regular" at the beginning. I also cleaned up the TeX code so the picture that's displayed looks more like the way most American authors write about continued fractions. And I talked to RobinH, who apparently originated the article on generalized continued fractions. I have put a slightly more general definition over there that applies to continued fractions which can be evaluated using arithmetic in any number field.

"... so we can be sure it is not original research" -- Now that's funny! Continued fractions (in the form described in this basic article) were apparently known to the Egyptians. At least, they had discovered the infinite sequence of convergents to √2 -- 3/2, 7/5, 17/12, 41/29, ... something like 4,000 years ago. Euler (d. 1783) produced a lot of analytical results using continued fractions, which he apparently regarded as nothing more than another way to express an infinite series. Gauss (d. 1855) used continued fractions in many sorts of calculations, and developed formulas (with complex z sprinkled liberally throughout them) using cf's to facilitate the calculation of tables of logarithms, tables of trigonometric functions, etc.

When Weierstrass and his crew started insisting on rigorous proofs in calculus, the analytical forms of the continued fraction fell into disrepute, except among the people who had to make real calculations ... in general, well-formed continued fractions for functions like ln and sin and arctan converge a whole lot faster than the best of their series counterparts. But they're pretty hard to work with from the pure math viewpoint. Proving convergence is a whole lot tougher with continued fractions than it is with infinite series. Weierstrass never got far with them, and therefore a whole generation of math students never learned much about them.

It remained for the 20th century to put the theory of continued fractions on a rigorous basis. While it's true that some convergence problems are still too tough, it's now pretty easy to show that many of Gauss's formulas, dating back to 1825, at least, are rigorously true.

Most people aren't aware of this, but when you ask your computer to calculate a number like the natural logarithm of 3, or the arctangent of 175.687, it doesn't use a Taylor series. It uses a continued fraction, often one that's been optimized to converge very quickly within a limited range. A whole lot of the pure math work that supports modern computers got coded into the library subroutines for FORTRAN, and we've been carrying that stuff forward ever since. Why reinvent the wheel?

I don't want to take credit for KFG's discoveries -- I just want to be able to write about them without having to redefine a simple term like "continued fraction". DavidCBryant 21:13, 4 December 2006 (UTC)

More opinions. DavidCBryant 00:05, 6 December 2006 (UTC)

To DavidCBryant: You said "...well-formed continued fractions for functions like ln and sin and arctan converge a whole lot faster than the best of their series counterparts.". I would like to know more about this. I was working on the pages for Natural logarithms and Inverse trigonometric functions and I was disappointed at how slowly the series converge. JRSpriggs 07:33, 6 December 2006 (UTC)

Inaccuracy

The article states that, "Every finite continued fraction is rational, and every rational number can be represented in precisely two different ways as a finite continued fraction, which agree except at the very end." However, this is inaccurate: there are an infinite number of ways to represent any given rational number as a continued fraction:
[a0; a1, a2, a3, ..., an + 1]
[a0; a1, a2, a3, ..., an, 1]
[a0; a1, a2, a3, ..., an, 0, 1]
[a0; a1, a2, a3, ..., an, 0, 0, 1]
...
Granted, these are trivial, but saying that there are exactly two ways to represent a continued fraction is misleading. This is implied in other parts of the article as well. 66.32.24.171 19:20, 28 January 2007 (UTC)

Hi, 66.32.24.171! That's an astute observation, but you're overlooking something.
  • The definition of a "continued fraction" in this article (as it now stands) says that "...all the other numbers an are positive integers." Zero is not a positive integer. So the cases with the extra "0"s are ruled out by the definition.
Is it less misleading now? Or does this point require additional clarification? DavidCBryant 19:59, 28 January 2007 (UTC)
PS I got into an argument with some other editors a while back because I wanted to call the "continued fractions" in this article "regular continued fractions in canonical form", or "simple continued fractions in canonical form", mainly because the restriction of partial denominators to positive integers rules out a lot of interesting continued fractions from complex analysis. But I lost that argument, so for the time being the things I naturally think of as "continued fractions" are not defined as such in Wikipedia – they're "generalized continued fractions" instead. dcb

Yes, you're right. I'm sorry for overlooking that. (I am the same person, just on a school network instead of home.) I guess that closes the matter. 152.23.77.52 18:53, 29 January 2007 (UTC)

Assessment

I added an assessment of this article as "Start" class, importance "High". The reason I didn't rate it higher on the quality scale was that, although it seems to have an appropriate depth of content, the organization of that content is lacking. In addition I found the motivation section shallow; to my mind the application to diophantine approximation is what gives this subject its high importance, but one has to pore through the whole article to find that. —David Eppstein 04:44, 8 February 2007 (UTC)

Clarification

In "Best rational approximations":

Added subscripts to clarify which term was being used in the expressions. Otherwise it would be difficult to be sure which term of series is meant. JKSellers 18:07, 5 March 2007 (UTC)

Added k index values to table to be consistent with a k used in a couple paragraphs down. JKSellers 18:23, 5 March 2007 (UTC)

Minor adjustment to make comments referring to the changes I made at 18:07, 5 March 2007 more consistent. Strictly speaking, the article is correct without the clarifications I added. However, the changes I made were in an area I had have dealt with a number of times and in a number of different applications with programmers new to the concepts, and the clarification I added will save effort to for most new readers wishing to understand this small part. JKSellers 18:52, 5 March 2007 (UTC)


Contradiction in article

In the bullet-pointed, desirable features of continued fraction notation in the Motivation section, it is stated that "The terms of a continued fraction will repeat if and only if it is the continued fraction representation of a quadratic irrational, that is, a real solution to a quadratic equation with integer coefficients". But in the Periodic continued fractions subsection of the Other continued fraction expansions section, it is stated that "The numbers with periodic continued fraction expansion are precisely the solutions of quadratic equations with rational coefficients.". Which is it? This needs fixing Djr36 21:46, 27 March 2007 (UTC)

There is no contradiction, because they are the same thing: a number is a solution of some quadratic equation with integer coefficients if and only if it is also the solution of some quadratic equation with rational coefficients.
To see this, suppose x is a root of px2 + qx + r, where p, q, and r are rational. Let d be the product of the denominators of p, q, and r. Then dpx2 + dqx + dr is a quadratic polynomial with integer coefficients, and x is also a root of this polynomnial.
For example, consider the equation (1/3)x2 + (1/2)x + 1/6 = 0. The solutions of this equation are precisely the same as the solutions of 12x2 + 18x + 6 = 0. (Here I multiplied everything by 36. Of course multiplying everything by 6 would have worked too.)
I believe that this should be clear to almost anyone with enough mathematical background to understand the rest of the article. -- Dominus 22:46, 27 March 2007 (UTC)

Biology or Divinity?

Not only am I using a fractious Talk headline here (just to be silly), but in my recent edit of the Motivation section, I also "by mistake on purpose" removed the French spacing -- I know that that is the purest form of instigation, and I truly repent. No really. Since the days of NuPedia I have seen casks of blood spilled over the non-issue of French spacing.

But the reason for this Talk comment was this uncited (or at least unneeded) statement:

Why 10? This is because of a biological accident, not because of anything related to mathematics. 10 is used because it is the standard base of our number system (10 fingers)

And even if you can cite it, why say it at all? It is the sheerest ecumenism.

Some cultures used base 60 with no ill effects. (Ancient Macedonian Accounting Standards, Winston Stoat-Pamphlet, 1987, Iceberg Community College)

A case can be made for base 6 just because you can easily run up a tally on one hand of 5, and keep track of the 6s on the other hand. You can count to 35 (even up to 71 if you stick your tongue out for the 36 column): 1556.

I am not trying to disrupt our collegiality to prove a point, I truly value this article and have learned much by studying it.

Caltrop 01:59, 15 April 2007 (UTC)

Your arguments about bases 6 and 60 are nonsequiturs. The article asserted merely that the constant 10 appeared because of a biological accident, which I believe is true; it did not assert that the biological accident made the use of 10 inevitable, which I agree with you is untrue.
I hope this clears up your confusion. -- Dominus 10:20, 15 April 2007 (UTC)

Lagrange spectrum

I just changed a subtitle "Golden ratio is the most irrational number" to "A property of the golden ratio φ". I had two reasons. First, it's hyperbole; and second, it's not true. Even ignoring the fact that no irrational number can be "more irrational" than another one, the heading was misleading because there are in fact infinitely many real numbers whose regular continued fraction expansions end in the string […1, 1, 1, …]. See this article.

Sorry, I was carried away by the hyperbole. :) Ricardo sandoval 19:07, 24 April 2007 (UTC)
There's no need to apologize. It's actually a pretty cute way to describe the √5/(5n2) limitation. Maybe it can be rewritten somehow, so that it's not just cute, but also true.  ;^> DavidCBryant 19:46, 24 April 2007 (UTC)

While I was rewriting this section of continued fraction I also noticed that Lagrange spectrum and Markov spectrum do not exist. If anybody who's interested in this stuff wants to write a new article, either or both of those would be great! DavidCBryant 19:14, 23 April 2007 (UTC)

Typing error

By the topic of "Infinite continued fractions", I found the convergent of [a0;a1,a2,a3...]should be like this:

a0, (a0a1 + 1)/a1, [a0(a1a2 + 1) + a2] / (a1a2 + 1), {a0[a1(a2a3 + 1) + a3] + (a2a3 + 1)} / [a1(a2a3 + 1) + a3]

>because:

a0 + 1 / (a1 + 1 / a2) =a0 + 1 / [(a1a2 + 1) / a2] =a0 + a2 / (a1a2 + 1) =[a0(a1a2+1) + a2] / (a1a2 + 1)

>and this:

a0 + 1 / [a1 + 1 / (a2 + 1 / a3)] = a0 + 1 / {a1 + 1 / [(a2a3 + 1) / a3]} = a0 + 1 / {a1 + a3 / (a2a3 + 1)} = a0 + 1 / {[a1(a2a3 + 1) + a3] / (a2a3 + 1)} = a0 + (a2a3 + 1) / [a1(a2a3 + 1) + a3] = {a0[a1(a2a3 + 1) + a3] + (a2a3 + 1)} / [a1(a2a3 + 1) + a3]

Meavel 10:17, 28 May 2007 (UTC)meavel, 28 May 2007, 6:14PM

Suggestion

By the topic of "Calculating continued fraction representations", I think I have a better way to do this. Because fractions is better than decimals.

Solution 1 3.245 = 3 + 245 / 1000 = 3 + 1 / (1000/245) = 3 + 1 / (4 + (20 / 245)) = 3 + 1 / (4 + (1 / (245 / 20))) = 3 + 1 / (4 + (1 / (12 + (5 / 20)))) = 3 + 1 / (4 + (1 / (12 + (1 / 4)))) =[3;4,12,4]

OR

Solution 2

by calculation of 3.245...

1000/245 = 4 + 20/245; 245/20 = 12 + 5/20; 20/5 = 4

3.245 = [3;4,12,4]

Better than the original page: 3.245-3=0.245, 1/0.245=4.082,4.082-4=0.482,1/0.482...

Meavel 10:20, 28 May 2007 (UTC)meavel. 28 May 2007, 4:14PM

Convergence of relative error?

In the section on "best rational approximations", it points out that "|dx−n| < |cx−m| so long as ". Is it true that tends to 0 as tends to infinity? It isn't obviously implied by the convergence of the continued fraction itself. LachlanA 20:32, 28 May 2007 (UTC)

It is true that |dk xnk| tends to zero as k→∞. And, in the case of the regular continued fractions discussed in this article, it's also clear that the convergence of this difference to zero is implied by the convergence of the continued fraction itself.
The thing to remember is that the even convergents of the continued fraction are all less than x, and form an increasing sequence, while the odd convergents are all greater than x and form a decreasing sequence. If x is a rational number there is no question of convergence, since the continued fraction terminates. For an irrational x both the odd and even sequences converge to the same number, which must be x by the well-ordering principle. DavidCBryant 22:13, 28 May 2007 (UTC)
Thanks, David. It still isn't obvious to me. Your explanation shows that the continued fraction itself converges to x (i.e., the absolute error tends to 0), but I can't see where it mentions the rate of convergence. My question was about the relative error (relative to ). We are multiplying the error by an increasing quantity, . If the convergents were given by "" then your explanation shows that converges to 0, but we still have bounded away from 0. Perhaps I should have asked "(Why) is the convergence of the continued fraction faster than linear in d_k?". Thanks again, LachlanA 02:45, 30 May 2007 (UTC)
OK, LachlanA – I'm sorry I misfired the first time. You want to know why the quantity |dkx −nk|→0 as k grows without bound, where x is an irrational real number, and nk and dk are the numerator and denominator of the kth convergent of the regular continued fraction for x. Right? I hope so, because this is going to be a fairly long explanation.
Before you read the rest of this, you might want to read fundamental recurrence formulas and complete quotient. In particular you need to understand the determinant formula for regular continued fractions
and also the formula expressing x as a semiconvergent:
(Here ζk+1 = [ak+1; ak+2, ak+3, …] is the k+1st complete quotient of the regular continued fraction for x. I hope you'll take my word for it that this formula can be easily proved by induction on k.)
The rest of the demonstration is really just some algebra:
and this can immediately be rewritten as
I think this last formula should answer your question, LachlanA – the dks are a sequence of strictly increasing positive integers, and ζk+1 > 1, so the right hand side of this last equality must approach zero as k increases. DavidCBryant 11:26, 30 May 2007 (UTC)
That's exactly what I was after. Thanks! LachlanA 22:04, 30 May 2007 (UTC)

attention

By the topic of "Infinite continued fractions", I found the convergent of [a0;a1,a2,a3...]should be like this:

a0, (a0a1 + 1)/a1, [a0(a1a2 + 1) + a2] / (a1a2 + 1), {a0[a1(a2a3 + 1) + a3] + (a2a3 + 1)} / [a1(a2a3 + 1) + a3]

>because:

a0 + 1 / (a1 + 1 / a2) =a0 + 1 / [(a1a2 + 1) / a2] =a0 + a2 / (a1a2 + 1) =[a0(a1a2+1) + a2] / (a1a2 + 1)

>and this:

a0 + 1 / [a1 + 1 / (a2 + 1 / a3)] = a0 + 1 / {a1 + 1 / [(a2a3 + 1) / a3]} = a0 + 1 / {a1 + a3 / (a2a3 + 1)} = a0 + 1 / {[a1(a2a3 + 1) + a3] / (a2a3 + 1)} = a0 + (a2a3 + 1) / [a1(a2a3 + 1) + a3] = {a0[a1(a2a3 + 1) + a3] + (a2a3 + 1)} / [a1(a2a3 + 1) + a3]


Somebody who knows TEX language please correct it. I talked it for two months.

--Meavel 06:48, 31 July 2007 (UTC)

I'm sorry, Meavel, but your formula is wrong. The formula in the article is correct. Please consult the references if you want to see a proof. Or write to me on my talk page and I'll show you the correct algebra (proof by induction) over there. DavidCBryant 12:09, 31 July 2007 (UTC)

missing entry: comparison of two continued fractions.

Clearly a section about the comparison of two continued fractions is missing. If that section would be added the section about best approximations could be shortened and made more clear. Hkleinnl (talk) 11:46, 18 December 2007 (UTC)

Added the section about comparison of CF's. Shortened section about best rational approximations. Hkleinnl (talk) 20:34, 24 December 2007 (UTC)

floating point numbers

At the bottom of the section titled "Calculating continued fraction representations" the following appears:

The number 3.245 can also be represented by the continued fraction expansion [3; 4, 12, 3, 1]; refer to Finite continued fractions below.
This algorithm is suitable for real numbers, but can lead to numerical disaster if implemented :with floating point numbers. Instead, any floating point number is an exact rational (the :denominator is usually a power of two on modern computers, and a power of ten on electronic :calculators), so a variant of Euclid's GCD algorithm can be used to give exact results.

As currently phrased, this is confusing. I'm revising it to more accurately reflect the problem and the correct solution. Solemnavalanche (talk) 18:46, 23 December 2007 (UTC)

citation needed

"One theorem states that any real number k can be approximated by rational m/n " .. I'd like to see a reference for this, and the name of the theorem cited. —Preceding unsigned comment added by 99.226.209.46 (talk) 05:19, 6 January 2008 (UTC)

It's Theorem 193 in Hardy & Wright (5th ed.) - I've added a reference in the article. Gandalf61 (talk) 17:23, 6 January 2008 (UTC)

Rational induction

As an additional point of interest, the fact that all rational numbers can be represented as a finite continued fraction allows mathematical induction to be extended to the positive rationals. This can be done by proving:

1. is true
2. If is true, then is true
3. If is true, then is true

Using these operations, it is possible to create all finite continued fractions and hence all rational numbers. Perhaps this deserves a mention on either this page or the page on induction?

--124.189.100.175 (talk) 03:03, 12 January 2008 (UTC)

That can be done without continued fractions. E.g., consider a grid of points in a coordinate system, e.g. {..., -3, -2, -1, 0, 1, 2, 3, ...} X {1, 2, 3, ...}. Define a sequence going through all these points, beginning at (0, 1), spiralling or zigzagging outwards as you please. Let each point (p, q) represent the fraction p/q, and skip it if it is not to lowest terms. Of course, this skipping in some contexts may makes this sequence inferior to the one suggested by 124.189.100.175, so I guess what I'm saying is, if we include 124.189.100.175's sequence in the article, we should indicate what it might be good for.--Niels Ø (noe) (talk) 11:23, 12 January 2008 (UTC)

representation of 1

Every finite continued fraction represents a rational number, and every rational number (except 1) can be represented in precisely two different ways as a finite continued fraction.

Why except 1? 1 can also be represented in two different ways : 1 = [1] = [0;1]. Indeed any integer n = [n] = [n-1;1].--143.248.181.36 (talk) 06:48, 28 January 2008 (UTC)

Theorem 2

Is Theorem 2 really a Theorem? All it is, is the definition of h and k, which is a given. TechnoFaye Kane 03:28, 8 February 2008 (UTC)

As the article stands, hn and kn are defined at the beginning of the Some useful theorems section as integer sequences with recurrence relations that use the an as parameters. So, yes, it is then necessary to prove that hn/kn is the nth convergent of the continued fraction. An alternative approach is to reverse the order, defining hn and kn as the numerator and denominator of the nth convergent, and then showing that hn and kn satisfy the recurrence relations. Gandalf61 (talk) 11:17, 8 February 2008 (UTC)
THANK YOU!!!! TechnoFaye Kane 20:46, 8 February 2008 (UTC)

Nerd Bias

I saw this at the beginning of the first section, "Motivation", and it made me laugh:

Most people are familiar with the decimal representation of real numbers:

It looks as if it's being said that most people understand the above mathematical representation. Freaked me out.

(This entry edited once for my own reasons. New sig below)

- Misha Vargas

216.254.12.114 (talk) 04:08, 21 November 2008 (UTC)

This is only true. Most people are familiar with decimal representation, even if not in the rigorous form. Scineram (talk) 11:38, 17 December 2008 (UTC)

Terminology of partial quotients

The opening section introduces the terminology of partial numerators and partial denominators that pertain to generalized continued fractions. But we fail to mention that for the simple or regular continued fractions dealt with in this article (having all partial numerators 1) the positive integers ai are termed partial quotients. Cf. the linked Wikipedia article on "restricted partial quotients".

My suggestion is to introduce the partial quotients terminology in the opening and to make the topic of generalized continued fractions a subsection (as is often done with generalizations of a math concept). Hardmath (talk) 12:15, 27 May 2009 (UTC)

infinite continued fraction

Let's discuss about the formula of this picture:

from infinite continued fraction of continued fraction. Continued_fraction

please compare with this.


and here is my proof to show that conflicts.

Answer:Covergents:

--Meavel (talk) 00:26, 17 March 2008 (UTC)
As far as I can see the formulae are only seemingly different, but in fact the same Hkleinnl —Preceding comment was added at 20:00, 19 March 2008 (UTC)
Yes, if you expand the numerator and denominator in each case, you will find that the two match. Asmeurer (talkcontribs) 17:27, 13 September 2009 (UTC)

exp(2/odd) incorrect

The formula given on the page does not produce the correct continued fraction. Using this formula for k=0, 1, ... and n=5 yields
[1; 2, 30, 12, 1, 1, 5 ...]
But Wolfram suggests http://www01.wolframalpha.com/input/?i=exp+%282%2F5%29
[1; 2, 30, 12, 1, 1, 17, 90, 27, 1, 1, 32, 150, 42, 1, 1, 47, 210, 57, 1, ...]
Wolfram's CF also collapses to an approximation that agrees with all floating point approximation formulas (scheme, google, etc). I cannot find a reference that represents this sequence as a simple continued fraction elsewhere. Does anyone have the correct formula and a reference? Erislover (talk) 04:00, 18 July 2009 (UTC)

The formula should have read "3nk" instead of "3k" and has now been corrected. Thanks. Glenn L (talk) 04:31, 18 July 2009 (UTC)

Comparison of continued fractions

Could anybody give an exact reference of that fact, please? I cannot find it in any book. Thanks. 147.83.133.93 (talk) 09:17, 28 July 2009 (UTC)

Have you looked in Khinchin? I would be very surprised if it were not there. —Dominus (talk) 14:43, 28 July 2009 (UTC)
It does follow immediately from theorem 4 on page 6 (for finite continued fractions) and theorem 8 on page 9 (for infinite continued fractions). —Dominus (talk) 14:46, 28 July 2009 (UTC)
Are you sure? Theorem 4 on page 6 is equivalent to Theorem 4. But I'm not sure that comparison of continued fractions' result is an immediat consequence of that. Any ideas? Thank you. 147.83.133.93 (talk) 10:46, 29 July 2009 (UTC)

suggestion for theorem 4

This one of 5 useful theorems stated without proof. Why not state what is more basic in this case. Something like this:

Theorem 4 The even convergents continually increase and the odd convergents continually decrease. Also, every even convergent is less than every odd convergent. In symbols

Furthermore, each convergent is closer to the next than the previous to it was . In other words, in the decreasing positive sequence each term is less than half the previous one.

Combining these:

Corollary 1: For an infinite (simple positive) continued fraction, there is exactly one real number a which is greater than all the even convergents and less than all the odd ones. --Gentlemath (talk) 07:14, 4 October 2009 (UTC)

hmm... maybe the word midpoint would scan more easily

Theorem 4 The even convergents continually increase and the odd convergents continually decrease. Also, every even convergent is less than every odd convergent. In symbols .

This means that each convergent (starting with ) is inside the interval determined by the two previous ones. Furthermore, it is on the same side of the midpoint as the immediately previous convergent is. In other words, in the decreasing positive sequence each term is less than half the previous one.

Combining these:

Corollary 1: For an infinite (simple positive) continued fraction, there is exactly one real number a which is greater than all the even convergents and less than all the odd ones.

--Gentlemath (talk) 08:04, 4 October 2009 (UTC)

best rational approximation

The word "decrement" in the "best rational approximation" section in this article doesn't look right to me. Around here, "decrement" usually means "subtract 1 from", but that is not exactly what we want here.

Given some number

there are some cases where

is a better rational approximation to x than

.

How can we clarify the "best rational approximation" section of this article so it clearly includes ? --68.0.124.33 (talk) 18:48, 18 August 2009 (UTC)

For your first remark, you're right. We want to "add 1 to" instead of "subtract 1 from", so "increment" is the correct term. I have amended the article to incorporate this.--Glenn L (talk) 19:58, 18 August 2009 (UTC)
Thank you. Alas, while your well-intentioned edit now includes the special cases I mentioned, it still doesn't cover every case of "best rational approximation".
In particular, the example in the "Best rational approximations" section.
That example says that [0;1,3] is one of the best rational approximations to [0;1,5,2,2].
You can't get "3" from "5" with a simple decrement or a simple increment.
--68.0.124.33 (talk) 02:16, 5 September 2009 (UTC)
This may help explain the progression of "best rational approximations" (b.r.a.) to x = [0;1,5,2,2] = 0.84375:
x0 = [0] = 0/1 = 0; d0 = |x - x0| = 0.84375 - this IS a b.r.a. because x < 1.
x1 = [0;1] = 1/1 = 1; d1 = |x - x1| = 0.15625 < d0 - this also IS a b.r.a.
x21 = [0;1,1] = 1/2 = 0.5; d21 = |x - x21| = 0.34375 > d1 - NOT a b.r.a.
x22 = [0;1;2] = 2/3 ≈ 0.66667; d22 = |x - x22| ≈ 0.17708 > d1 - NOT.
x23 = [0;1,3] = 3/4 = 0.75; d23 = |x - x23| = 0.09375 < d1 - IS.
x24 = [0;1,4] = 4/5 = 0.8; d24 = |x - x24| = 0.04375 < d23 - IS.
x25 = [0;1,5] = 5/6 ≈ 0.83333; d25 = |x - x25| ≈ 0.01042 < d24 - IS.
x31 = [0;1,5,1] = 6/7 ≈ 0.85714; d31 = |x - x31| ≈ 0.01339 > d25 - NOT.
x32 = [0;1,5,2] = 11/13 ≈ 0.84615; d32 = |x - x32| ≈ 0.00240 < d25 - IS.
x41 = [0;1,5,2,1] = 16/19 ≈ 0.84211; d41 = |x - x41| ≈ 0.00164 < d32 - IS.
x42 = [0;1,5,2,2] = 27/32 = 0.84375 = x. We can stop here.
So x0, x1, x23, x24, x25, x32 and x41 are "best rational approximations" while x21, x22 and x31 are not.--Glenn L (talk) 04:59, 5 September 2009 (UTC)

Decrement was correct, and I have restored it. To get them in order you start at half of the last quotient before truncation (subject to rule 3) and go up to the full value of the quotient, but never higher. The case

is handled by being equal to the lowest value derived from the convergent out to , i.e. usually

However, I'm a bit concerned that the whole section may have been plagiarized from an article in "Graphics Gems V". 66.92.234.221 (talk) 04:41, 14 January 2010 (UTC)

the "half rule"

What is meant by?:

One formal description of the half rule is that the halved term, 12 ak, is admissible if and only if

Is it really correct that the indexes are starting with and going down with the first elipses? In all other cases the indexes increase as we go to the right. Also, are the indexes going up with the second elipses, with the implication that we take the limit as the number of terms goes to infinity? Thanks! Quantling (talk) 17:03, 31 March 2010 (UTC)

Best rational within an interval

What is the rational with the smallest denominator that falls within the interval , , , or ? If both x and y are irrational the four cases are identical; and with

where and have identical continued fraction expansions up through , I believe the answer is equal to

If x is rational, one has to take care to choose the appropriate one of the two representations for x; in some sense one uses the continued fraction expansion of either or , depending upon whether the lower bound is more like an irrational of the form or an irrational of the form . Specifically, for a rational within or within , the lower bound is, in some sense, ; one should use if k is even; one should use if k is odd. If one wants a rational within or then the lower bound is more like , and the choice for the appropriate expansion of x is the other way around.

Similarly, if y is rational, for a rational within or within , the upper bound is, in some sense, ; one should use if k is odd; one should use if k is even. If one wants a rational within or then the upper bound is more like , and the choice for the appropriate expansion of y is the other way around.

With these choices one uses the formula above applicable to irrational numbers, unless these choices leave the expansions for x and y equal up to the length of the shorter one. In this last case, truncate the longer one to one term more than the shorter one, incrementing the very last value in the truncated sequence.

If this is truth does anyone have a citable source? Quantling (talk) 19:27, 12 April 2010 (UTC)

You are right, at least in the case of irrationals (for rational boundaries I didn't check; it is somewhat messy in any case). To understand such questions, look at Stern–Brocot tree, to which I just added a link and corrected the contents for you convenience. In fact a better way to think of a path in the Stern–Brocot tree is a a sequence of left/right decisions rather than continued fractions; a coefficient ai corresponds to that many successive decisions in the same direction (after which the direction changes), except for the final coefficient which gives one less such decision. Then to compare two paths find the largest common prefix; if both paths continue beyond that point (in different directions) then this gives the simplest fraction in the interval. If only one path continues, then either take the common prefix if the interval was closed at this end, if not continue one step in the direction of the longer path if that gives a valid point of the interval, and if not (an open interval of which we just visited both boundaries) continue one step in the opposite direction of the last step. It is straightforward (though a bit cumbersome) to translate all this back into the language of continued fractions. Marc van Leeuwen (talk) 10:09, 13 April 2010 (UTC)

Non-unique decimal representation

Would another benefit over decimal representations worth mentioning be that some numbers do not have unique decimal representations (when the decimal ends in an infinite string of 9's)? Asmeurer (talkcontribs) 17:23, 13 September 2009 (UTC)

Isn't it the case that every rational does not have a unique continued fraction representation? That is, always equals , yes? In this sense continued fraction representations are worse than decimal representations; for the latter not all rational numbers have non-unique representations. Quantling (talk) 18:04, 31 March 2010 (UTC)

EXTERNAL LINKS

I wonder what makes a person so "priviliged" that his/her external-link is allowed to appear at wikipedia. I mean, if Wikipedia does not like EXTERNAL LINKS then WIKIPEDIA SHOULD NOT mantain the external-links section. I think it is an obvious public-outrage for many people to realize that only two or three guys are "priviliged" by wikipedia, i do not see any justice on that. Wikipedia should either mantain the EXTERNAL LINKS in another related page or definitely eliminate all of them. What makes some few guys so "privileged"? What makes some guy to be the judge for selecting only two or three external links? Mirificium (talk) 22:47, 20 March 2010 (UTC)

Improper definition

I'm often astonished about how people can be at ease with definitions that don't even begin to make sense. The current lede is an example: "In mathematics, a continued fraction is an expression such as

"

With the dots in there, it is not an expression because part of it is not specified (how should one evaluate such an expression)? If the dots stand for infinite continuation in a similar fashion (as the term "continued" suggests), it is not an expression either, because (1) it is infinite (not much hope for evaluating such an expression), and (2) viewing it as an infinitely nested tree structure, there is no place to even begin evaluation of the expression. So no, a continued fraction is not an expression of that kind, the continued faction associated to a sequence of integers is a sequence of rational numbers, defined using expressions similar to the one depicted, but without dots (or by recurrence). Also I see no clear mention in the article that all infinite continued fractions actually designate a well defined real number, in other words a convergence statement. I'll make a stab at giving a more sensible definition and description, while remaining coherent with what is said later in the article. Marc van Leeuwen (talk) 08:50, 2 April 2010 (UTC)

Good point! Since you didn't edit the article right away, I took a shot. If my edits collide with yours, feel free to overwrite mine, or merge, or whatever. Quantling (talk) 14:04, 2 April 2010 (UTC)

Table @ "Calculating continued fraction representations"

How do these changes to the table look?


Calculating continued fraction representations

Consider a real number r. Let i be the integer part and f the fractional part of r. Then the continued fraction representation of r is [i; a1, a2,...], where [a1; a2,...] is the continued fraction representation of 1/f.

To calculate a continued fraction representation of a number r, write down the integer part (technically the floor) of r. Subtract this integer part from r. If the difference is 0, stop; otherwise find the reciprocal of the difference and repeat. The procedure will halt if and only if r is rational.

Find the continued fraction for 3.245
Real Number Integer portion (floor) Fractional portion Simplified fraction Reciprocal of Simplification of
STOP
Continued fraction form for 3.245 is [3; 4, 12, 4]

The number 3.245 can also be represented by the continued fraction expansion [3; 4, 12, 3, 1]; refer to Finite continued fractions below.

This algorithm is suitable for real numbers, but the limited precision of floating point numbers will often lead to small errors, skewing the final result. Instead, floating point numbers should be converted to rational numbers. The denominator is usually a power of two on modern computers, and a power of ten on electronic calculators, so a variant of Euclid's GCD algorithm can be used to give exact results.


I think that this will be much easier to read and understand. The original version was like this:

Find the continued fraction for 3.245
STOP
Continued fraction form for 3.245 is [3; 4, 12, 4]

By the way, previous edits by 65.190.71.252 were by me as well. Pisharov (talk) 20:07, 2 June 2010 (UTC)

Did a little more.Pisharov (talk) 20:08, 2 June 2010 (UTC)

Lanczos algorithm -- Eigenvalues and eigenvectors

Would someone please be so friendly and explain where in this Krylov space method the continued fractions occur? -- LutzL (talk) 10:03, 29 July 2010 (UTC)

fractional iteration of continued fraction

i'm not sure wether this is appropriate here, so feel free to remove the link which I've just added. In the context of fractional iteration( and tetration) I consider the fraction 1/(1+x) as iterable, so as finite and infinite continued fraction. Maybe this link to fractional iteration has some informative value in the article here (generalizations ) Feel free to remove the link if not appropriate -

Gottfried Helms--Gotti 15:23, 1 August 2010 (UTC) —Preceding unsigned comment added by Druseltal2005 (talkcontribs)

reverting why ?

I made this change for the algorighm. You may wonder why, but the main reason is that the algorithm shown wants us to simplify and reduce the intermediate fractions, which is something only optional and absolutely not needed for the algorithm itself (this can still be done without changing the algorithm, because all rational numbers are allowing such trasnforms, and the article is not about speaking how we can "simplify" rationals.)

In fact it it just simpler to NOT simplify the fractions at all, as the algorithm will simply reduce the numbers up to the final results: there's absolutely no change in the value.

Also, I wanted to demonstrate how the continued fractions change when we change only the sign of the real number. The revert does not demonstrate this, and only speaks about positive numbers (despite of the fact that continued fractions are ALSO defined for negative numbers. My change was a more conclusive evidence.

I also used a rational number with decimals higher than 0.5, just to demonstrate that the approximants in the canonical are not the best ones and not the most rapidly converging ones. That's why I added another algorithm changing the integer function used (rounding to nearest instead of reounding towards zero or minus infinity, something that the algorithm forgets to state clearly). I was also clearly saying that the a_n numbers will then be possibly positive or negative.

This modification not only reduces the number of terms, but also allows the successive continuants to converge in average twice faster per step.

Calculating continued fraction representations

Consider a real number r0. Let a0 be the integer part and f0 the fractional part of r0. Then the continued fraction representation of r0 is [a0; a1, a2,...], where [a1; a2,...] is the continued fraction representation of 1/f0.

To calculate a continued fraction representation of a number r0, write down the integer part (technically the floor) of r0. Subtract this integer part from r0. If the difference is 0, stop; otherwise find the reciprocal of the difference and repeat. The procedure will halt if and only if r0 is rational.

Find the canonical continued fractions for 3.645 (= 3645/1000), −3.645 (= −3645/1000), and 0
Real number Integer part (floor) Fractional part Reciprocal Canonical continued fraction form
r0 = 3645/1000 a0 = 3 f0 = 645/1000 1/f0 = 1000/645
r1 = 1000/645 a1 = 1 f1 = 355/645 1/f1 = 645/355
r2 = 645/355 a2 = 1 f2 = 290/355 1/f2 = 355/290
r3 = 355/290 a3 = 1 f3 = 65/290 1/f3 = 290/65
r4 = 290/65 a4 = 4 f4 = 30/65 1/f4 = 65/30
r5 = 65/30 a5 = 2 f5 = 5/30 1/f5 = 30/5
r6 = 30/5 a6 = 6 f6 = 0/5 stop
r0 = −3645/1000 a0 = −4 f0 = 355/1000 1/f0 = 1000/355
r1 = 1000/355 a1 = 2 f1 = 290/355 1/f1 = 355/290
r2 = 355/290 a2 = 1 f2 = 65/290 1/f2 = 290/65
r3 = 290/65 a3 = 4 f3 = 30/65 1/f3 = 65/30
r4 = 65/30 a4 = 2 f4 = 5/30 1/f4 = 30/5
r5 = 30/5 a5 = 6 f5 = 0/5 stop
r0 = 0 a0 = 0 f0 = 0 stop

The number 3.645 can also be represented by the continued fraction expansion [3; 1, 1, 4, 2, 5, 1]; refer to Finite continued fractions below.

This algorithm is suitable for all real numbers, but the limited precision of floating point numbers will often lead to small errors, skewing the final result. Instead, floating point numbers should be converted to rational numbers before processing. The denominator is usually a power of two on modern computers, and a power of ten on electronic calculators, so basic Euclidian divisions can be used directly (the Euclid GCD algorithm may be optionally be used to simplify the intermediate fractions, but this is not needed to compute all the terms of the continued fraction).

This algorithm works as well for negative numbers, but the beginning terms in of the continued fraction expansion are different.

A similar algorithm can be used to compute shorter generalized continued fractions (with a smaller number of terms).

Note also that I wanted to used consistant notations (the same used in the presentation of the article), that why I used a_n instead of i, because it helps understanding which values in the table are computed in the result.

Finally the presentation of the table is wikified, and allows for several examples (the continued fraction is show beside what is computed, it is comparable more easily.

Now someone is saying that I don't give sources. The sources are the same as the original article, it's just a reformulation also suppressing the need for simplifying fractions and the need of a GCD, which is completely false, even if the GCD algorithm is related to this one (so this is effectively duplicating the computing work).

Now the modified algorithm (using rounding to nearest integer) is also interesting:

Calculating generalized continued fraction representations

The algorithm presented here computes the shortest representation for generalized continued fractions, and is similar to the one used for computing "canonical" continued fraction representations, when restricting an=1 for all n. It can be used for all converging generalized continued fractions (to which all real numbers are uniquely and bijectively associated, including irrational numbers). Consider a real number r0. Let b0 be the nearest integer from r0 and f0 the fractional part of r0 as the positive or negative difference from b0 to r0. Then the continued fraction representation of r0 is [b0; b1, b2,...], where [b1; b2,...] is the continued fraction representation of 1/f0.

To calculate the shortest generalized continued fraction representation of a number r0, write down the nearest integer part of r0. Subtract this integer part from r0. If the difference is 0, stop; otherwise find the reciprocal of the difference and repeat. The procedure will halt if and only if r0 is rational.

The nearest integer function is chosen so that that it selects the integer quotient bn that best approximates the real number rn at each step (instead of choosing the floor function in the canonical algorithm above), so that the remainder fractional term fn will be at most half of unity in absolute value (choosing for the quotient bn the integer with the smallest absolute value if the real number is exactly halfway between two integers), technically a "round half towards zero" function, i.e.

it will generate expansions that may converge faster (with less terms) than with the canonical representation of continued fractions; however, the fractional terms will be positive or negative, and so will be the next terms bn of this expansion. This algorithm works as well with any negative or null real numbers.

With such modification of the initial algorithm for continued fractions, we get :

Find the shortest generalized continued fractions for 3.645 (= 3645/1000), −3.645 (= −3645/1000), and 0
Real number Integer part (nearest) Fractional part Reciprocal Shortest continued fraction form
r0 = 3645/1000 b0 = 4 f0 = −355/1000 1/f0 = −1000/355
r1 = −1000/355 b1 = −3 f1 = 65/355 1/f1 = 355/65
r2 = 355/65 b2 = 5 f2 = 30/65 1/f2 = 65/30
r3 = 65/30 b3 = 2 f3 = 5/30 1/f3 = 30/5
r4 = 30/5 b4 = 6 f4 = 0/5 stop
r0 = −3645/1000 b0 = −4 f0 = 355/1000 1/f0 = 1000/355
r1 = 1000/355 b1 = 3 f1 = −65/355 1/f1 = −355/65
r2 = −355/65 b2 = −5 f2 = −30/65 1/f2 = −65/30
r3 = −65/30 b3 = −2 f3 = −5/30 1/f3 = −30/5
r4 = −30/5 b4 = −6 f4 = 0/5 stop
r0 = 0 b0 = 0 f0 = 0 stop

This algorithm also produces the shortest generalized continued fraction expansion for negative numbers (with the restriction above on an=1), where all its terms are the negation of the terms in the shortest generalized continued fraction expansion of the opposite positive numbers, with also exactly the same number of terms. It will most often be more practical for rational numbers, or for expressing numeric approximants for irrational functions with limited precision.

However it may be simpler to express various classes of irrational numbers with their full precision using the generalized continued fraction without this restriction. Shorter generalized representations (with less terms) are of course possible if we remove the constraint an=1, notably with rational numbers that can be represented simply as a simple fraction of two integers, with a single value for a0 and for b0; however the convenient [b0; b1, b2, ...] shorthand notation is no longer usable.

Notably, you can compare how negative and positive real numbers are converted to very similar continued fractions, by just changing the sign. Note that someone argues that using negative numbers for a_n values with n>0 is not a continuous fraction (yes it is a generalized fraction), but all this depends on authors conventions about what they consider as the canonical form.

My books gives the shortest form that include negative terms as the canonical form, simply:

  • because of its simpler numerical forms and numerical properties (for example negative numbers),
  • also because it is exactly the same form for all continued fractions, including other generalized continued fractions (that don't need the sign restrictions on numerators or denominators),
  • also because it is more stable numerically when using the formula to compute the numeric value of irrationals from the continued fractions in this form, with limited precision numbers (like float and double in various computer language) resulting in smaller roundoff errors (at most one ups of precision),
  • also because it offers better successive approximants, even if all numerators (are still restricted to 1 : for them the "generalized" continued fraction is only for the case where the numerators may be different from 1, so that the shorthand notation [a0; a1, a2...] is no longer usable). I learned these continued fractions under the shortest forms, and NEVER performed simplification steps (by dividing with the GCD, as this is not needed and will be done naturally in the rest of the algorithm, also because this step also requires performing the euclidian division, which is what the next step is already performing).

Finally, I really don't like the notation of rationals (in the existing article) with an implicit plus between the integer part and the fractional part (it is used in customary notations by bookkeepers and traders or gambling bookmakers, but it has no place in a mathematical article where only the multiplication sign may be implicit.

Really, you should understand what you delete so abruptly...

verdy_p (talk) 04:38, 12 August 2010 (UTC)

Yes, I understood your changes, but I disagreed with them and reverted them because:
  1. In the lead section, this page defines a canonical continued fraction as one whose terms are positive integers (apart possibly from the first term a0). Discussion of any other type of continued fraction belongs in the generalized continued fraction article.
    Yes but this second expansion from the generalized continued article. But this convention of using ONLY positive terms is an anglosaxon convention, which is not mandatory, in fact it can be easily proven that including negative numbers in a_n does not change the set of numbers that can be expressed with a finite continued fraction, and that all periodic continued fractions with positive only terms can also be rewritten with periodic continued fractions including negative terms (the reverse being true as well). The transform from one form to the other is a local only transform (i.e. it involves only a subrange of terms with a lenth never exceeding the periodic length). That's why I leanrd continued fractions without this restriction of positive only terms. (Also because of mathematical properties with obvious transforms between positive and negative numbers). verdy_p (talk) 08:00, 13 August 2010 (UTC)
    Separate article or self-contained section: The simplest convention is to choose the integer with floor(). While round() has some nice features, it isn't the only alternative. One obvious choice is ceiling(). Another is ceiling()+1. Another is alternating floor() with "1". Another is choosing an arbitrary integer. Sure, you'll have convergence problems unless you choose a "close enough" integer at least some of the time, but that too could all be explained, if we let the article get long enough. I think it best to stick to the floor() convention, with any alternatives in separate articles or, at the very least, within self-contained sections of this article. That's my 2¢. Quantling (talk) 14:04, 13 August 2010 (UTC)
  2. The mixed-fraction representation in the table shows clearly where the next integer term comes from, and it is a pity to loose that. So it is obvious that the integer part of is 12; it is less clear that the integer part of is 12. The goal of examples is clarity, not efficiency.
    But the existing assertion that the algorithm REQUIRES computing the gcd (i.e. simplifying it) is simply false. It's absolutely not needed to see where the next integer term comes from (just refer to the article about rational numbers, we are not in an article explaining how rational numbers can be simplified !). All that is needed is a simple euclidian division, not a GCD, "simplifying fractions" is not absolutely needed for the algorithm to produce the correct integer parts, as it does not even change the number of steps or generated terms.
    In fact, adding such "simplification" just makes the algorithm more complex to understand and less readable. The integer part is shown on the next row where it becomes needed: just perform the euclidian division, it displays it immediately, without adding extra columns and computing substeps.
    In addition, as I said, the notation with implicit plus is customary in daylife, but is INVALID in mathematical applications, notably here where the plus sign is mandatory to avoid lots of confusions, notably between continued fractions and fractions, which is exactly what the article is constantly about ! I also wanted to avoid using this ambiguous notation here. verdy_p (talk) 08:00, 13 August 2010 (UTC)
  3. The bottom half of your tables, with the black background, is unreadable in my browser.
    ?????? Huh???? 'There's absolutely no black background ! This is a pure wikitable (the only color specified is a light shade of blue on some rows, and there's no complex positioning). Your own local installation must be bogous (most probably a bogous user script or stylesheet in your own personal Monibook or Vector theme). This is an built invention by you, only there to add an argument, or you have serious problems with rendering all wikitables used everywhere in Wikipedia (I can't reproduce it in IE8, Firefox, Opera, Chrome, Safari, and even in an old Netscape 4; tested on Windows 7, Vista, XP, Linux, FreeBSD, Solaris, OpenVMS, and two kinds of X11 servers). verdy_p (talk) 08:00, 13 August 2010 (UTC)
  4. Your description of the modified "nearest integer" method makes several assertions about convergence, length etc. which need sources. Gandalf61 (talk) 10:04, 12 August 2010 (UTC)
    This is not false, in fact you can immediately show that the difference remaining after each term is below 1/2 in absolute value, instead of 1 in absolute value when taking the simple integer part. This also means that the residual error is divided by 2 on average on each step (and you can easily prove that it divides the length of periods by 2, using local transforms. All the existing algorithms on continued fractions with positive only terms (excet a_0) also apply to continued fractions with negative terms, except that the continued fractions will converge exponentially faster (by an order of magnitude of 2^n on average). Continued fractions with positive only numbers are just a bad and unneeded restrictions. But this does not make them becoming as general as generalized continued fractions (for example the expansion of pi remains aperiodic, even if there are periodic expansions of pi using generalized fractions, where the numerators are not 1). The only change was about possibly negative denominators but numerators are still all restricted to 1, so the usual shorhand notation [a0; a1, a2, ...] is still usable without any change (in fact this also justifies why the semicolon can be safely replaced by a comma, because all terms can be any positive or negative numbers). verdy_p (talk) 08:16, 13 August 2010 (UTC)
You say "?????? Huh???? 'There's absolutely no black background !" ... when I wrote my comments, the bottom half of the table above used colour code "#EEF" and appeared black like this:
xxxxxxx
Then you edited the colour code to "#EEEEFF", so it now appears blue like this:
xxxxxxx
As you seem to be incapable of responding politely, I see no point in continuing this discussion. I am done here. Gandalf61 (talk) 09:35, 13 August 2010 (UTC)
I don't want to comment on the rest of the edits, but I'd like to point out that #EEF and #EEEEFF are equivalent colour specifications (in general, #rgb is the same as #rrggbb, see [1]), and they both denote a light shade of bluish grey. I'm afraid your browser is broken, if it displays one of them as black.—Emil J. 12:07, 13 August 2010 (UTC)
Browser is IE7. With #EEF I see black background on two different machines (both with IE7) and with both Vector and Monobook skins. Happy to accept this may be an IE7 artefact. What I object to is verdy_p's characterisation of my observation as "bogous" and an "invention", plus the generally rude tone of the rest of his responses. Gandalf61 (talk) 12:27, 13 August 2010 (UTC)
You were rude by deleting everything (as if this was invention from me; the discussion below clearly demonstrates that I did not invent anything), and using false arguments to justify your deletions/reverts, and not just the one about colors (which was also a false claim). Update your antic IE7 (even IE8 is still not conforming with its XML parsing, and still does not correctly parse CSS even if it does not honor all its properties, because it is mixing separate CSS properties by adding some of them in the value or another perfectly valid CSS property, due to many internal buffer overruns or underruns in its bogous parsers...) or change your non-conforming browser and you'll be done with the problem, but if you still have the bug, this is not because my table used 3-digit hex colors instead of 6 digits.
If I edited the colors AFTER, this was not because I saw the problem but possibly because I felt that it could have solved your problem, but clearly this change was not needed: If your IE7 fails to recognize an extremely basic and essential CSS1 unit that has absolutely no impact on the more complex layout of pages, how can you trust it for showing you any content on the Internet? verdy_p (talk) 08:14, 16 August 2010 (UTC)