trigamma.qbk 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. [section:trigamma Trigamma]
  2. [h4 Synopsis]
  3. ``
  4. #include <boost/math/special_functions/trigamma.hpp>
  5. ``
  6. namespace boost{ namespace math{
  7. template <class T>
  8. ``__sf_result`` trigamma(T x);
  9. template <class T, class ``__Policy``>
  10. ``__sf_result`` trigamma(T x, const ``__Policy``&);
  11. }} // namespaces
  12. [h4 Description]
  13. Returns the trigamma function of /x/. Trigamma is defined as the
  14. derivative of the digamma function:
  15. [equation trigamma1]
  16. [graph trigamma]
  17. [optional_policy]
  18. The return type of this function is computed using the __arg_promotion_rules:
  19. the result is of type `double` when T is an integer type, and type T otherwise.
  20. [h4 Accuracy]
  21. The following table shows the peak errors (in units of epsilon)
  22. found on various platforms with various floating point types.
  23. Unless otherwise specified any floating point type that is narrower
  24. than the one shown will have __zero_error.
  25. [table_trigamma]
  26. As shown above, error rates are generally very low for built in types.
  27. For multiprecision types, error rates are typically in the order of a
  28. few epsilon.
  29. The following error plot are based on an exhaustive search of the functions domain, MSVC-15.5 at `double` precision,
  30. and GCC-7.1/Ubuntu for `long double` and `__float128`.
  31. [graph trigamma__double]
  32. [graph trigamma__80_bit_long_double]
  33. [graph trigamma____float128]
  34. [h4 Testing]
  35. Testing is against Mathematica generated spot values to 35 digit precision.
  36. [h4 Implementation]
  37. The arbitrary precision version of this function simply calls __polygamma.
  38. For built in fixed-precision types, negative arguments are first made positive via:
  39. [equation trigamma2]
  40. Then arguments in the range \[0, 1) are shifted to >= 1 via:
  41. [equation trigamma3]
  42. Then evaluation is via one of a number of rational approximations, for small /x/ these are
  43. of the form:
  44. [equation trigamma4]
  45. and for large /x/ of the form:
  46. [equation trigamma5]
  47. [endsect] [/section:digamma The Trigamma Function]
  48. [/
  49. Copyright 2014 John Maddock and Paul A. Bristow.
  50. Distributed under the Boost Software License, Version 1.0.
  51. (See accompanying file LICENSE_1_0.txt or copy at
  52. http://www.boost.org/LICENSE_1_0.txt).
  53. ]