Imported Upstream version 1.51.0
[platform/upstream/boost.git] / libs / math / doc / sf / zeta.qbk
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    
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.
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    
32 Returns the [@http://mathworld.wolfram.com/RiemannZetaFunction.html zeta function]
33 of z:
34
35 [equation zeta1]
36
37 [graph zeta1]
38
39 [graph zeta2]
40
41 [h4 Accuracy]
42
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.
48
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
52
53 GSL Peak=8.7 Mean=1.0 
54
55 __cephes Peak=2.1 Mean=1.1
56 ]  [Peak=7.1 Mean=3.0 
57
58 GSL Peak=137 Mean=14 
59
60 __cephes Peak=5084 Mean=470
61 ]]
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]]
65 ]
66
67 [h4 Testing]
68
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. 
78
79 [h4 Implementation]
80
81 All versions of these functions first use the usual reflection formulas
82 to make their arguments positive:
83
84 [equation zeta3]
85
86 The generic versions of these functions are implemented using the series:
87
88 [equation zeta6]
89
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.
93
94 For 0 < z < 1 the approximating form is:
95
96 [equation zeta4]
97
98 For a rational approximation R(1-z) and a constant C.
99
100 For 1 < z < 4 the approximating form is:
101
102 [equation zeta5]
103
104 For a rational approximation R(n-z) and a constant C and integer n.
105
106 For z > 4 the approximating form is:
107
108 [zeta](z) = 1 + e[super R(z - n)]
109
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.
114
115 [endsect]
116 [/ :error_function The Error Functions]
117
118 [/ 
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).
123 ]