1 [section:zeta Riemann Zeta Function]
6 #include <boost/math/special_functions/zeta.hpp>
9 namespace boost{ namespace math{
12 ``__sf_result`` zeta(T z);
14 template <class T, class ``__Policy``>
15 ``__sf_result`` zeta(T z, const ``__Policy``&);
19 The return type of these functions is computed using the __arg_pomotion_rules:
20 the return type is `double` if T is an integer type, and T otherwise.
27 ``__sf_result`` zeta(T z);
29 template <class T, class ``__Policy``>
30 ``__sf_result`` zeta(T z, const ``__Policy``&);
32 Returns the [@http://mathworld.wolfram.com/RiemannZetaFunction.html zeta function]
43 The following table shows the peak errors (in units of epsilon)
44 found on various platforms with various floating point types,
45 along with comparisons to the __gsl and __cephes libraries.
46 Unless otherwise specified any floating point type that is narrower
47 than the one shown will have __zero_error.
49 [table Errors In the Function zeta(z)
50 [[Significand Size] [Platform and Compiler] [z > 0][z < 0]]
51 [[53] [Win32, Visual C++ 8] [Peak=0.99 Mean=0.1
55 __cephes Peak=2.1 Mean=1.1
60 __cephes Peak=5084 Mean=470
62 [[64] [RedHat Linux IA_EM64, gcc-4.1] [Peak=0.99 Mean=0.5] [Peak=570 Mean=60]]
63 [[64] [Redhat Linux IA64, gcc-4.1] [Peak=0.99 Mean=0.5] [Peak=559 Mean=56]]
64 [[113] [HPUX IA64, aCC A.06.06] [Peak=1.0 Mean=0.4] [Peak=1018 Mean=79]]
69 The tests for these functions come in two parts:
70 basic sanity checks use spot values calculated using
71 [@http://functions.wolfram.com/webMathematica/FunctionEvaluation.jsp?name=Zeta Mathworld's online evaluator],
72 while accuracy checks use high-precision test values calculated at 1000-bit precision with
73 [@http://shoup.net/ntl/doc/RR.txt NTL::RR] and this implementation.
74 Note that the generic and type-specific
75 versions of these functions use differing implementations internally, so this
76 gives us reasonably independent test data. Using our test data to test other
77 "known good" implementations also provides an additional sanity check.
81 All versions of these functions first use the usual reflection formulas
82 to make their arguments positive:
86 The generic versions of these functions are implemented using the series:
90 When the significand (mantissa) size is recognised
91 (currently for 53, 64 and 113-bit reals, plus single-precision 24-bit handled via promotion to double)
92 then a series of rational approximations [jm_rationals] are used.
94 For 0 < z < 1 the approximating form is:
98 For a rational approximation R(1-z) and a constant C.
100 For 1 < z < 4 the approximating form is:
104 For a rational approximation R(n-z) and a constant C and integer n.
106 For z > 4 the approximating form is:
108 [zeta](z) = 1 + e[super R(z - n)]
110 For a rational approximation R(z-n) and integer n, note that the accuracy
111 required for R(z-n) is not full machine precision, but an absolute error
112 of: [epsilon]/R(0). This saves us quite a few digits when dealing with large
113 z, especially when [epsilon] is small.
116 [/ :error_function The Error Functions]
119 Copyright 2006 John Maddock and Paul A. Bristow.
120 Distributed under the Boost Software License, Version 1.0.
121 (See accompanying file LICENSE_1_0.txt or copy at
122 http://www.boost.org/LICENSE_1_0.txt).