# Natural Logarithm Approximated by Continued Fractions

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

Continued fractions provide a very effective toolset for approximating functions. Usually the continued fraction expansion of a function approximates the function better than its Taylor or Fourier series. This Demonstration compares the quality of three approximations to . One is the Taylor series and the other two are continued fraction expansions. The first continued fraction expansion can be obtained as a canonical even contraction of a continued fraction using Euler's method to transform a series to an -fraction. The other continued fraction expansion was developed by the author as a canonical even contraction from the first one.

Contributed by: Andreas Lauschke (March 2011)
Open content licensed under CC BY-NC-SA

## Details

Vary the number of terms used in the expansions to see that the Taylor series makes hardly any progress. The terms in the Taylor polynomial become progressively more complicated; higher terms have huge numbers in the numerator, the denominator, and the exponent, but the contribution of this "expense" becomes quite stale. In fact, in the base-10 log plot the green curve is mostly above the axis.

The continued fraction expansion approximates the natural logarithm by several orders of magnitude better, as can be seen in the log-plot of the relative errors. It is generally a shortcoming of polynomials that for large they cannot approximate functions well that converge to constants or do not have zeros, as polynomials tend to for large . Rational function approximation—for example continued fractions or Padé approximations—or certain special functions are much better.

The original continued fraction is

.

The continued fraction resulting from the author's canonical even contraction (using HornerForm for all polynomials) is

,

with

and

.