]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/doc/sf/zeta.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / math / doc / sf / zeta.qbk
CommitLineData
7c673cae
FG
1[section:zeta Riemann Zeta Function]
2
3[h4 Synopsis]
4
5``
6#include <boost/math/special_functions/zeta.hpp>
7``
8
9 namespace boost{ namespace math{
10
11 template <class T>
12 ``__sf_result`` zeta(T z);
13
14 template <class T, class ``__Policy``>
15 ``__sf_result`` zeta(T z, const ``__Policy``&);
16
17 }} // namespaces
18
19The return type of these functions is computed using the __arg_promotion_rules:
20the return type is `double` if T is an integer type, and T otherwise.
21
22[optional_policy]
23
24[h4 Description]
25
26 template <class T>
27 ``__sf_result`` zeta(T z);
28
29 template <class T, class ``__Policy``>
30 ``__sf_result`` zeta(T z, const ``__Policy``&);
31
32Returns the [@http://mathworld.wolfram.com/RiemannZetaFunction.html zeta function]
33of z:
34
35[equation zeta1]
36
37[graph zeta1]
38
39[graph zeta2]
40
41[h4 Accuracy]
42
43The following table shows the peak errors (in units of epsilon)
44found on various platforms with various floating point types,
45along with comparisons to the __gsl and __cephes libraries.
46Unless otherwise specified any floating point type that is narrower
47than the one shown will have __zero_error.
48
49[table_zeta]
50
51[h4 Testing]
52
53The tests for these functions come in two parts:
54basic sanity checks use spot values calculated using
55[@http://functions.wolfram.com/webMathematica/FunctionEvaluation.jsp?name=Zeta Mathworld's online evaluator],
56while accuracy checks use high-precision test values calculated at 1000-bit precision with
57[@http://shoup.net/ntl/doc/RR.txt NTL::RR] and this implementation.
58Note that the generic and type-specific
59versions of these functions use differing implementations internally, so this
60gives us reasonably independent test data. Using our test data to test other
61"known good" implementations also provides an additional sanity check.
62
63[h4 Implementation]
64
65All versions of these functions first use the usual reflection formulas
66to make their arguments positive:
67
68[equation zeta3]
69
70The generic versions of these functions are implemented using the series:
71
72[equation zeta6]
73
74When the significand (mantissa) size is recognised
75(currently for 53, 64 and 113-bit reals, plus single-precision 24-bit handled via promotion to double)
76then a series of rational approximations [jm_rationals] are used.
77
78For 0 < z < 1 the approximating form is:
79
80[equation zeta4]
81
82For a rational approximation R(1-z) and a constant C.
83
84For 1 < z < 4 the approximating form is:
85
86[equation zeta5]
87
88For a rational approximation R(n-z) and a constant C and integer n.
89
90For z > 4 the approximating form is:
91
92[zeta](z) = 1 + e[super R(z - n)]
93
94For a rational approximation R(z-n) and integer n, note that the accuracy
95required for R(z-n) is not full machine precision, but an absolute error
96of: [epsilon]/R(0). This saves us quite a few digits when dealing with large
97z, especially when [epsilon] is small.
98
99Finally, there are some special cases for integer arguments, there are
100closed forms for negative or even integers:
101
102[equation zeta7]
103
104[equation zeta8]
105
106[equation zeta9]
107
108and for positive odd integers we simply cache pre-computed values as these are of great
109benefit to some infinite series calculations.
110
111[endsect]
112[/ :error_function The Error Functions]
113
114[/
115 Copyright 2006 John Maddock and Paul A. Bristow.
116 Distributed under the Boost Software License, Version 1.0.
117 (See accompanying file LICENSE_1_0.txt or copy at
118 http://www.boost.org/LICENSE_1_0.txt).
119]