]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | ||
21 | Returns the trigamma function of /x/. Trigamma is defined as the | |
22 | derivative of the digamma function: | |
23 | ||
24 | [equation trigamma1] | |
25 | ||
26 | [graph trigamma] | |
27 | ||
28 | [optional_policy] | |
29 | ||
30 | The return type of this function is computed using the __arg_promotion_rules: | |
31 | the result is of type `double` when T is an integer type, and type T otherwise. | |
32 | ||
33 | [h4 Accuracy] | |
34 | ||
35 | The following table shows the peak errors (in units of epsilon) | |
36 | found on various platforms with various floating point types. | |
37 | Unless otherwise specified any floating point type that is narrower | |
38 | than the one shown will have __zero_error. | |
39 | ||
40 | [table_trigamma] | |
41 | ||
42 | As shown above, error rates are generally very low for built in types. | |
43 | For multiprecision types, error rates are typically in the order of a | |
44 | few epsilon. | |
45 | ||
46 | [h4 Testing] | |
47 | ||
48 | Testing is against Mathematica generated spot values to 35 digit precision. | |
49 | ||
50 | [h4 Implementation] | |
51 | ||
52 | The arbitrary precision version of this function simply calls __polygamma. | |
53 | ||
54 | For built in fixed precision types, negative arguments are first made positive via: | |
55 | ||
56 | [equation trigamma2] | |
57 | ||
58 | Then arguments in the range \[0, 1) are shifted to >= 1 via: | |
59 | ||
60 | [equation trigamma3] | |
61 | ||
62 | Then evaluation is via one of a number of rational approximations, for small x these are | |
63 | of the form: | |
64 | ||
65 | [equation trigamma4] | |
66 | ||
67 | and for large x of the form: | |
68 | ||
69 | [equation trigamma5] | |
70 | ||
71 | [endsect][/section:digamma The Trigamma Function] | |
72 | ||
73 | [/ | |
74 | Copyright 2014 John Maddock and Paul A. Bristow. | |
75 | Distributed under the Boost Software License, Version 1.0. | |
76 | (See accompanying file LICENSE_1_0.txt or copy at | |
77 | http://www.boost.org/LICENSE_1_0.txt). | |
78 | ] | |
79 |