Stata: Data Analysis and Statistical Software
   >> Home >> Resources & support >> FAQs >> Calculating the Euler–Mascheroni constant

How do I get the Euler–Mascheroni constant gamma = 0.57721... in Stata?

Title   Calculating the Euler–Mascheroni constant
Author Nicholas J. Cox, Durham University, UK
Date December 2003; minor revisions January 2006

The Euler–Mascheroni constant gamma = 0.57721 ... is one of the most important constants in mathematics. For some background, see Havil (2003) and/or Finch (2003, 28–40). In statistics, gamma arises, for example, in the theory of certain probability distributions.

In Stata, gamma can be calculated using the function digamma() as −digamma(1) (note the negative sign). For example,

        . di %12.10f −digamma(1) 

yields 0.5772156649. See also help math functions for details about related functions.

References

Finch, S. R. 2003. Mathematical Constants.
Cambridge: Cambridge University Press.
Havil, J. 2003. Gamma: Exploring Euler's Constant.
Princeton: Princeton University Press.
Bookmark and Share 
FAQs
What's new?
Statistics
Data management
Graphics
Programming Stata
Mata
Resources
Internet capabilities
Stata for Windows
Stata for Unix
Stata for Mac
Technical support
Like us on Facebook Follow us on Twitter Follow us on LinkedIn Google+ Watch us on YouTube
Follow us
© Copyright 1996–2013 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index   |   View mobile site