Evaluates the Trigamma function.

View versions (1)

Interface

#include <codecogs/maths/special/gamma/trigamma.h>

using namespace Maths::Special::Gamma;

This component evaluates the Trigamma function with given parameters, defined by the second derivative of the logarithm of the Gamma function:

\psi_1(x) = \frac{\mathrm{d}^2}{\mathrm{d}x^2} \mathrm{ln} \Gamma(x)
(1)

In the following example, arguments from the [3, 4] interval are used, with step equal to 0.2, to evaluate the Trigamma function.

Example 1

#include <codecogs/maths/special/gamma/trigamma.h>
#include <iostream>
#include <iomanip>

int main()
{
  std::cout << std::setprecision(10);
  for (double x = 3; x < 5; x += 0.2)
  {
    std::cout << "Trigamma(" << x << ") = ";
    std::cout << Maths::Special::Gamma::trigamma(x) << std::endl;
  }
  return 0;
}

Output

Trigamma(3) = 0.3949340655
Trigamma(3.2) = 0.3663211898
Trigamma(3.4) = 0.3415413972
Trigamma(3.6) = 0.3198778986
Trigamma(3.8) = 0.3007811415
Trigamma(4) = 0.2838229544
Trigamma(4.2) = 0.2686649398
Trigamma(4.4) = 0.2550362069
Trigamma(4.6) = 0.2427174048
Trigamma(4.8) = 0.2315290639

Parameters

x
the argument of the trigamma function

Returns

An approximation of the Trigamma function with the given argument.

References

John Burkardt&#039;s library of statistical C++ routines, http://www.csit.fsu.edu/~burkardt/cpp_src/prob/prob.html

GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

x
Result