e01.org

Lentz's algorithm

In mathematics, Lentz's algorithm is an algorithm to evaluate continued fractions, and was originally devised to compute tables of spherical Bessel functions. The version often employed now is the simplification due to Thompson and Barnett. Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.

In mathematics, Lentz's algorithm is an algorithm to evaluate continued fractions, and was originally devised to compute tables of spherical Bessel functions. The version often employed now is the simplification due to Thompson and Barnett. f_0 = b_0 f_1 = b_0 + \frac{a_1}{b_1} f_2 = b_0 + \frac{a_1}{b_1 + \frac{a_2}{b_2}} f_3 = b_0 + \frac{a_1}{b_1 + \frac{a_2}{b_2 + \frac{a_3}{b_3}}} etc., or using the big-K notation, if f_n = b_0 + \underset{j = 1}\overset{n}\operatorname{K}\frac{a_j}{b_j} is the n th convergent to f then f_n = \frac{A_n}{B_n} where A_n and B_n are given by the Wallis-Euler recurrence relations \begin{align} A_{-1} & = 1 & B_{-1} & = 0\\ A_0 & = b_0 & B_0 & = 1\\ A_n & = b_n A_{n-1} + a_n A_{n-2} & B_n & = b_n B_{n-1} + a_n B_{n-2} \end{align} Lentz's method defines C_n = \frac{A_n}{A_{n - 1}} D_n = \frac{B_{n - 1}}{B_n} so that the n th convergent is f_n = C_n D_n f_{n - 1} with f_0 = \frac{A_0}{B_0} = b_0 and uses the recurrence relations \begin{align} C_0 & = \frac{A_0}{A_{-1}} = b_0 & D_0 & = \frac{B_{-1}}{B_0} = 0\\ C_n & = b_n + \frac{a_n}{C_{n-1}} & D_n & = \frac1{b_n + a_n D_{n-1}} \end{align} When the product C_n D_n reaches unity with increasing n to the accuracy of the computer, then f_n has converged to f . Lentz's algorithm has the advantage of side-stepping an inconvenience of the Wallis-Euler relations, namely that the numerators A_n and denominators B_n are prone to grow or diminish very rapidly with increasing n . In direct numerical application of the Wallis-Euler relations, this means that A_{n-1} , A_{n-2} , B_{n-1} , B_{n-2} must be periodically checked and rescaled to avoid floating-point overflow or underflow. In Lentz's original algorithm, it can happen that C_n = 0 , resulting in division by zero at the next step. A simpler method than that proposed by Lentz remedied the problem can be simply by setting C_n = \varepsilon for some sufficiently small \varepsilon . This gives C_{n + 1} = b_{n + 1} + \frac{a_{n + 1}}{\varepsilon} = \frac{a_{n + 1}}{\varepsilon} to within floating-point precision, and the product C_n C_{n + 1} = a_{n + 1} irrespective of the precise value of ε. Accordingly, the value of f_0 = C_0 = b_0 is also set to \varepsilon in the case of b_0 = 0 . Similarly, if the denominator in D_n = \frac{1}{b_n + a_n D_{n - 1}} is zero, then setting D_n = \frac{1}{\varepsilon} for small enough \varepsilon gives D_n D_{n + 1} = \frac{1}{a_{n + 1}} irrespective of the value of \varepsilon . ==References==

source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"Lentz's algorithm". 1782333282. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1360986564

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·