# Use of digamma function in root

**URL:** <https://root-forum.cern.ch/t/use-of-digamma-function-in-root/33622>\
**Category:** Newbie\
**Created:** [April 16, 2019, 8:44am UTC](https://root-forum.cern.ch/t/use-of-digamma-function-in-root/33622 "2019-04-16T08:44:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![remcodesmit](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/fbc32d/32.png) [@remcodesmit](https://root-forum.cern.ch/u/remcodesmit)\
**Post date:** [April 16, 2019, 8:44am UTC](https://root-forum.cern.ch/t/use-of-digamma-function-in-root/33622/1 "2019-04-16T08:44:29Z")

</div>

Dear,

For my project I have to fit a gamma distribution through my data points. This fit works well, but I want to extract data points from this fit with error bars. For these error bars I use partial derivatives w.r.t. to each parameter of my gamma distribution. Well here arises the problem…  
The derivative of the gamma distribution yields a digamma function, which I can’t find in the ROOT documentation. Is there another way to implement this function into ROOT?

Remco de Smit

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [April 16, 2019, 4:31pm UTC](https://root-forum.cern.ch/t/use-of-digamma-function-in-root/33622/2 "2019-04-16T16:31:01Z")

</div>

Hi,  
The digamma funciton is not available directly in ROOT. We could provide it if you think is needed.  
However, you can use it from GSL available through MathMore., that is an optional library of ROOT.  
From the prompt you just need to do:

```auto
#include "gsl/gsl_sf_psi.h"
gSystem->Load("libMathMore");
cout << gsl_sf_psi(1.) << endl;

```

see [https://www.gnu.org/software/gsl/manual/html\_node/Digamma-Function.html#Digamma-Function](https://www.gnu.org/software/gsl/manual/html_node/Digamma-Function.html#Digamma-Function)

Lorenzo
