Python code to calculate Euler-Macheroni constant to 50 decimal places
The Euler-Mascheroni constant, denoted by γ, is a mathematical constant that is approximately equal to 0.5772156649. It is named after the Swiss mathematician Leonhard Euler and the Italian mathematician Lorenzo Mascheroni.
You can use the math library in Python and the scipy library to calculate the Euler-Mascheroni constant to a certain number of decimal places.
Code
import math
from scipy import special
print('{:.50f}'.format(special.psi(1)))
This will print out γ to 50 decimal places. The scipy library provides a number of specialized functions and algorithms for scientific computing, including the psi function which returns the logarithmic derivative of the gamma function. The Euler-Mascheroni constant is equal to the limit of the difference between the natural logarithm of n and the harmonic series as n approaches infinity, which is related to the derivative of the logarithm of the gamma function at 1.
Output
0.5772156649015328606065120900824024310421