Lentz's algorithm

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

In mathematics, Lentz's algorithm is an algorithm to evaluate continued fractions,[1][full citation needed] and was originally devised to compute tables of spherical Bessel functions.[2][3]

The version often employed now is the simplification due to Thompson and Barnett.[4]

History

[edit | edit source]

The idea was introduced in 1973 by William J. Lentz[2] and was simplified by him in 1982.[5] Lentz suggested that calculating ratios of spherical Bessel functions of complex arguments over a wide range of values can be difficult. He developed a new continued fraction technique for calculating the ratios of spherical Bessel functions of consecutive order. This method was an improvement compared to other methods because it starts from the beginning of the continued fraction rather than the tail, had a built-in check for convergence, and is numerically stable. The original algorithm uses algebra to bypass a zero or near-zero independently in either the numerator or denominator.[6] Simpler Improvements to overcome unwanted zero terms include an altered recurrence relation[7] suggested by Jaaskelainen and Ruuskanen in 1981 or a simple shift of the denominator by a very small number as suggested by Thompson and Barnett in 1986.,[4] or Lentz's simplification.

Initial work

[edit | edit source]

This theory was initially motivated by Lentz's need for accurate calculation of ratios of spherical Bessel functions of consecutive order and complex argument necessary for Mie scattering. He created a new continued fraction algorithm that starts from the beginning of the continued fraction and not at the tail-end. This eliminates guessing how many terms of the continued fraction are needed for convergence. In addition, continued fraction representations for both ratios of Bessel functions and spherical Bessel functions of consecutive order themselves can be computed with Lentz's algorithm.[6] The algorithm suggested that it is possible to terminate the evaluation of continued fractions when |fjfj1| is relatively small.[8]

Algorithm

[edit | edit source]

Lentz's algorithm is based on the Wallis-Euler relations. John Wallis independently rediscovered the recursion relations about 500 years after the Indian mathematician Bhas-Cara II.[9]

For continued fractions, the definitive standard notation is found under "Elementary Analytical Methods", page 19 and throughout the text for each function.[10]

f0=b0
f1=b0+a1b1
f2=b0+a1b1+a2b2
f3=b0+a1b1+a2b2+a3b3

etc., or using the big-K notation, if

fn=b0+Knj=1ajbj

is the nth convergent to f then

fn=AnBn

where An and Bn are given by the Wallis-Euler recurrence relations

A1=1B1=0A0=b0B0=1An=bnAn1+anAn2Bn=bnBn1+anBn2

Lentz's method defines

Cn=AnAn1
Dn=Bn1Bn

so that the nth convergent is fn=CnDnfn1 with f0=A0B0=b0 and uses the recurrence relations

C0=A0A1=b0D0=B1B0=0Cn=bn+anCn1Dn=1bn+anDn1

When the product CnDn reaches unity with increasing n to the accuracy of the computer, then fn has converged to f.[11]

Lentz's algorithm has the advantage of side-stepping an inconvenience of the Wallis-Euler relations, namely that the numerators An and denominators Bn are prone to grow or diminish very rapidly with increasing n. In direct numerical application of the Wallis-Euler relations, this means that An1, An2, Bn1, Bn2 must be periodically checked and rescaled to avoid floating-point overflow or underflow.[11]

Thompson and Barnett modification

[edit | edit source]

In Lentz's original algorithm, it can happen that Cn=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 Cn=ε for some sufficiently small ε. This gives Cn+1=bn+1+an+1ε=an+1ε to within floating-point precision, and the product CnCn+1=an+1 irrespective of the precise value of ε. Accordingly, the value of f0=C0=b0 is also set to ε in the case of b0=0.

Similarly, if the denominator in Dn=1bn+anDn1 is zero, then setting Dn=1ε for small enough ε gives DnDn+1=1an+1 irrespective of the value of ε.[4][11]

Applications

[edit | edit source]

Lentz's algorithm was used widely in the late twentieth century. It was suggested that it doesn't have any rigorous analysis of error propagation. However, a few empirical tests suggest that it's at least as good as the other methods.[12] As an example, it was applied to evaluate exponential integral functions. This application was then called modified Lentz algorithm.[13] It's also stated that the Lentz algorithm is not applicable for every calculation, and convergence can be quite rapid for some continued fractions and vice versa for others.[14] If the terms of the continued fraction are constant or increasing, it is stable, but if the consecutive terms are decreasing, the algorithm may lose accuracy. This is because the forward recursion from which the algorithm is derived is unstable for decreasing terms.

References

[edit | edit source]
  1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  2. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  4. ^ a b c Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  5. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  6. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  7. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  8. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  9. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  10. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  11. ^ a b c Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  12. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  13. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  14. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).