1[section:trigamma Trigamma]
2
3[h4 Synopsis]
4
5``
6#include <boost/math/special_functions/trigamma.hpp>
7``
8
9  namespace boost{ namespace math{
10
11  template <class T>
12  ``__sf_result`` trigamma(T z);
13
14  template <class T, class ``__Policy``>
15  ``__sf_result`` trigamma(T z, const ``__Policy``&);
16
17  }} // namespaces
18
19[h4 Description]
20
21Returns the trigamma function of /x/. Trigamma is defined as the
22derivative of the digamma function:
23
24[equation trigamma1]
25
26[graph trigamma]
27
28[optional_policy]
29
30The return type of this function is computed using the __arg_pomotion_rules:
31the result is of type `double` when T is an integer type, and type T otherwise.
32
33[h4 Accuracy]
34
35The following table shows the peak errors (in units of epsilon)
36found on various platforms with various floating point types.
37Unless otherwise specified any floating point type that is narrower
38than the one shown will have __zero_error.
39
40[table
41[[Significand Size] [Platform and Compiler] [Random Values] ]
42[[53]            [Win32 Visual C++ 12]  [Peak=1.0 Mean=0.4] ]
43[[64]            [Win64 Mingw GCC]  [Peak=1.4 Mean=0.4]  ]
44[[113]           [Win64 Mingw GCC __float128]    [Peak=1.0 Mean=0.5] ]
45]
46
47As shown above, error rates are generally very low for built in types.
48For multiprecision types, error rates are typically in the order of a
49few epsilon.
50
51[h4 Testing]
52
53Testing is against Mathematica generated spot values to 35 digit precision.
54
55[h4 Implementation]
56
57The arbitrary precision version of this function simply calls __polygamma.
58
59For built in fixed precision types, negative arguments are first made positive via:
60
61[equation trigamma2]
62
63Then arguments in the range \[0, 1) are shifted to >= 1 via:
64
65[equation trigamma3]
66
67Then evaluation is via one of a number of rational approximations, for small x these are
68of the form:
69
70[equation trigamma4]
71
72and for large x of the form:
73
74[equation trigamma5]
75
76[endsect][/section:digamma The Trigamma Function]
77
78[/
79  Copyright 2014 John Maddock and Paul A. Bristow.
80  Distributed under the Boost Software License, Version 1.0.
81  (See accompanying file LICENSE_1_0.txt or copy at
82  http://www.boost.org/LICENSE_1_0.txt).
83]
84
85