summaryrefslogtreecommitdiff
path: root/boost/libs/math/doc/sf/polygamma.qbk
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
committerChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
commite0737c56c1e384e05064a0c6e1ac46979371041b (patch)
treea0123d694a2d36c43dabdf0a3907392fce11d457 /boost/libs/math/doc/sf/polygamma.qbk
parentb4aebf2d137b892f53503b13785ecae900062ff7 (diff)
New upstream version 2.0.0+repackupstream/2.0.0+repack
Diffstat (limited to 'boost/libs/math/doc/sf/polygamma.qbk')
-rw-r--r--boost/libs/math/doc/sf/polygamma.qbk110
1 files changed, 110 insertions, 0 deletions
diff --git a/boost/libs/math/doc/sf/polygamma.qbk b/boost/libs/math/doc/sf/polygamma.qbk
new file mode 100644
index 00000000..5155095a
--- /dev/null
+++ b/boost/libs/math/doc/sf/polygamma.qbk
@@ -0,0 +1,110 @@
+[section:polygamma Polygamma]
+
+[h4 Synopsis]
+
+``
+#include <boost/math/special_functions/polygamma.hpp>
+``
+
+ namespace boost{ namespace math{
+
+ template <class T>
+ ``__sf_result`` polygamma(int n, T z);
+
+ template <class T, class ``__Policy``>
+ ``__sf_result`` polygamma(int n, T z, const ``__Policy``&);
+
+ }} // namespaces
+
+[h4 Description]
+
+Returns the polygamma function of /x/. Polygamma is defined as the n'th
+derivative of the digamma function:
+
+[equation polygamma1]
+
+The following graphs illustrate the behaviour of the function for odd and even order:
+
+[graph polygamma2]
+[graph polygamma3]
+
+[optional_policy]
+
+The return type of this function is computed using the __arg_promotion_rules:
+the result is of type `double` when T is an integer type, and type T otherwise.
+
+[h4 Accuracy]
+
+The following table shows the peak errors (in units of epsilon)
+found on various platforms with various floating point types.
+Unless otherwise specified any floating point type that is narrower
+than the one shown will have __zero_error.
+
+[table_polygamma]
+
+As shown above, error rates are generally very acceptable for moderately sized
+arguments. Error rates should stay low for exact inputs, however, please note that the
+function becomes exceptionally sensitive to small changes in input for large n and negative x,
+indeed for cases where ['n!] would overflow, the function changes directly from -[infin] to
++[infin] somewhere between each negative integer - ['these cases are not handled correctly].
+
+[*For these reasons results should be treated with extreme caution when /n/ is large and x negative].
+
+[h4 Testing]
+
+Testing is against Mathematica generated spot values to 35 digit precision.
+
+[h4 Implementation]
+
+For x < 0 the following reflection formula is used:
+
+[equation polygamma2]
+
+The n'th derivative of ['cot(x)] is tabulated for small /n/, and for larger n
+has the general form:
+
+[equation polygamma3]
+
+The coefficients of the cosine terms can be calculated iteratively starting
+from ['C[sub 1,0] = -1] and then using
+
+[equation polygamma7]
+
+to generate coefficients for n+1.
+
+Note that every other coefficient is zero, and therefore what we have are
+even or odd polynomials depending on whether n is even or odd.
+
+Once x is positive then we have two methods available to us, for small x
+we use the series expansion:
+
+[equation polygamma4]
+
+Note that the evaluation of zeta functions at integer values is essentially a table lookup
+as __zeta is optimized for those cases.
+
+For large x we use the asymptotic expansion:
+
+[equation polygamma5]
+
+For x in-between the two extremes we use the relation:
+
+[equation polygamma6]
+
+to make x large enough for the asymptotic expansion to be used.
+
+There are also two special cases:
+
+[equation polygamma8]
+
+[equation polygamma9]
+
+[endsect][/section:polygamma The Polygamma Function]
+
+[/
+ Copyright 2014 John Maddock and Paul A. Bristow.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+