Continued Fractions and Weighted Mediants |
|
Wherefore, my beloved, as ye have always obeyed, not as in my presence only, but now much more in my absence, work out your own salvation... |
Philippians, 2:12 |
|
A simple continued fraction for the quantity x is an expression of the form |
|
|
|
where the aj coefficients are ordinarily positive integers. The convergents of this continued fraction are defined as the partial results |
|
|
|
and so on. Each convergent xn can be written as a simple fraction pn/qn where |
|
|
|
Notice that x2 can be expressed as |
|
|
|
Furthermore, it’s clear from the definitions of the convergents that if we have an expression for xn in terms of a0, a1, ..., an, then the value of xn+1 is given by simply replacing an with an + 1/an+1. Thus, for example, we can write x3 using the above expression for x2 as follows |
|
|
|
By induction it follows that |
|
|
|
for all n > 1. Thus each convergent of a simple continued fraction is the weighted mediant of the previous two convergents. This is depicted in the figure below for the first three convergents of the simple continued fraction for the square root of 2: |
|
|
|
In this case the coefficients are a0 = 1 and aj = 2 for all j>0. In general, the convergents always alternate on either side of the asymptotic value, because the weighted mediant is always between the two arguments. Notice that if an were equal to zero, then xn would equal xn−2, whereas for positive values of an the value of xn is weighted toward xn−1 (and approaches xn−1 as an goes to infinity). The coefficient an is always the largest integer such that xn is still on the opposite side of the asymptotic value from xn−1. |
|
A similar approach can be taken to evaluating more general forms of continued fractions. For example, consider a continued fraction of the form |
|
|
|
The first few convergents are |
|
|
|
Therefore, letting xn = pn/qn for the ratios written in this form, we have |
|
|
|
By similar reasoning to our analysis of simple continued fractions, we can say that the expression for x3 is given by replacing a2 in this expression with a2 + b3/a3. This leads to |
|
|
|
Again by induction it follows that, in general, we have |
|
|
|
for all n > 1. This shows (again) that each convergent is a weighted mediant of the two prior convergents. |
|
As an example, suppose we wish to evaluate the area under the upper tail of the normal curve from some u to infinity using Laplace’s expression |
|
|
|
We can evaluate the numerator (the quantity in parentheses) directly, so it only remains to determine the value of the continued fraction in the denominator. For this we have aj = u and bj = j for all j. Thus beginning with the initial values p0 = u and p1 = u2+1 we can compute all subsequent values of pj using the recurrence pn = upn−1 + npn−2. Likewise we have the initial values q0 = 1 and q1 = u, and we can compute all subsequent values of qj using the recurrence qn = uqn−1 + nqn−2. To illustrate, with u = 3 we get |
|
|
|
Thus we can recursively compute the denominator in Laplace’s formula to any desired precision. |
|