wiki

Gruntz algorithm

The Gruntz algorithm computes limits of exp-log functions at infinity[1]. Limits at a finite point reduce to this case by substituting or , and many special functions can be handled by rewriting them in exp-log form. Earlier limit procedures expanded the function in powers of , which fails whenever an exponentially small term decides the answer. Gruntz's method, from his 1996 thesis at ETH Zürich[1], instead expands in the most rapidly varying subexpression, using the comparability classes of Hardy's orders of infinity[2]. The recursion terminates because each step moves to a strictly lower class. It is used by SymPy's limit and was developed for Maple; related methods based on multiseries and transseries give full asymptotic expansions[3][4][5].

§ 01

Example

The bracket is the difference of two numbers that agree to about decimal digits, multiplied by a number that large. Evaluating it in floating point loses all accuracy once is a few tens, and expanding in powers of gives zero at every order. The answer depends only on , which is smaller than every power of .

The function evaluated directly and after rewriting it in w = e^(−x).

Running it.

x direct in terms of w
1 -2.27434683020919 -2.27434683020919
5 -1.21729711102195 -1.21729711102194
10 -1.10514583111641 -1.10514583111427
20 -1.05127117037794 -1.05127109529261
30 -1.03457307555225 -1.03389511351353
36 -0.957285705619525 -1.02816717743771
40 0 -1.02531512052443
100 0 -1.01005016708417
700 0 -1.00142959232282
§ 02

Comparability classes

Functions tending to 0 or are compared through their logarithms[1][2]. is more rapidly varying than , written , when

and they are in the same comparability class, , when the limit is finite and nonzero. A function tending to a finite nonzero constant is in the lowest class, below all others. So : every power of is in one class, , and are in the class above it, and is above both. Exp-log functions form a Hardy field, in which any two functions are eventually comparable, so these limits always exist in [2].

class of log xlog xlog² x√log xclass of xxx²1/x√x≺class of eˣeˣe⁻ˣe²ˣx·eˣ≺class of e^(x²)e^(x²)e^(x² + x)≺class of e^(eˣ)e^(eˣ)e^(−eˣ)≺more rapidly varying: log|f| / log|g| → ∞MRV set of the example: {eˣ, e⁻ˣ}
Comparability classes, ordered by growth. Functions in the same class have logarithms of comparable size, whether they tend to infinity or to zero; the MRV set of an expression is its subexpressions in the highest class present.

The MRV set is the set of subexpressions of in the highest comparability class present. It is computed recursively: for or , compare the classes of and and keep the higher, or their union if they are equal; for with , compare with . Each comparison is itself a limit of a smaller expression, computed by the same algorithm[1].

§ 03

Algorithm

For [1]:

1. Compute . If , substitute , which moves every class up one level without changing the limit, and start again.

2. Choose in the class of with , of the form . Every element of can then be written with and in a strictly lower class.

3. Substitute these into and expand as a power series in , treating the lower-class expressions as constants:

4. If the limit is 0; if it is , with the sign of ; if it is , computed recursively. The coefficient lies in a lower class than , so the recursion terminates.

§ 04

Worked examples

For the example above, the MRV set is . Take , so , and , which tends to 1, is in a lower class. Expanding,

The leading exponent is 0, so the limit is that of , which is . The rewritten form is also what the demo evaluates in its second column, and it is accurate for every .

For , the MRV set is , so the algorithm substitutes and obtains . Now and

with leading exponent 0 and , so the limit is 1.

§ 05

Why powers of 1/x are not enough

An expansion in powers of cannot find the first limit. Since is smaller than every power of , the bracket expands to zero at every order in , and the factor that makes the product finite is invisible. Older limit procedures based on such expansions, or on heuristics like repeated l'Hôpital's rule, either failed or returned wrong answers on such inputs[1]. The series has to be taken in the most rapidly varying quantity, which is what the MRV set provides; more generally, asymptotic expansions of exp-log functions are multiseries in several scales, or transseries[3][5].

§ 06

Zero equivalence

The algorithm has to decide whether the leading coefficient is identically zero, and whether constants such as the in step 2 are zero. If a zero coefficient is mistaken for a nonzero one, the answer is wrong. For exp-log expressions over this reduces to deciding whether exp-log constants are zero, which is not known to be decidable; Richardson showed that related problems for richer classes of functions are undecidable[6]. Gruntz's algorithm is therefore complete relative to a zero-equivalence oracle, the same limitation as the Risch algorithm. In practice systems use normal forms and numerical tests.

§ 07

History

Hardy introduced the orders of infinity and the comparability of functions in 1910[2]. Algorithms for asymptotic expansions of exp-log functions were developed in the late 1980s and 1990s by Shackell, Salvy, Richardson and van der Hoeven, using nested expansions and multiseries[3][4][7]. Gruntz's 1996 thesis gave the MRV method, simpler to implement because it needs only ordinary power series in one variable at each step, and implemented it in Maple[1]. SymPy's limit function is based on it. Van der Hoeven's theory of transseries gives the general framework in which such expansions live[5].

see also

further reading

  1. [1]D. Gruntz, On Computing Limits in a Symbolic Manipulation System, PhD thesis, ETH Zürich (1996).
  2. [2]G. H. Hardy, Orders of Infinity, Cambridge Tracts in Mathematics 12 (1910).
  3. [3]D. Richardson, B. Salvy, J. Shackell, J. van der Hoeven, “Asymptotic expansions of exp-log functions”, ISSAC (1996).
  4. [4]J. R. Shackell, Symbolic Asymptotics, Algorithms and Computation in Mathematics 12, Springer (2004).
  5. [5]J. van der Hoeven, Transseries and Real Differential Algebra, Lecture Notes in Mathematics 1888, Springer (2006).
  6. [6]D. Richardson, “Some undecidable problems involving elementary functions of a real variable”, Journal of Symbolic Logic 33 (1968).
  7. [7]B. Salvy, J. Shackell, “Symbolic asymptotics: multiseries of inverse functions”, Journal of Symbolic Computation 27 (1999).

last updated