Repository navigation
Euler's constant, eulergamma - #2204
Merged
Merged
Conversation
eulergamma is the Euler-Mascheroni constant, 0.5772156649..., and
EulerGamma, its name in Mathematica and SymPy, is read as it. It is
evaluated to the working precision by the Brent-McMillan routine the
exponential and trigonometric integrals already used, and it has a
value in the interval and decimal evaluators and in both compilers. It
draws as \mathrm{\gamma} and exports as sympy.EulerGamma.
With it the digamma function is exact at a whole or half-whole
argument: psi(1) = -gamma and psi(1/2) = -gamma - 2 ln 2, and the
recurrence from either. digamma(3) is 3/2 - eulergamma. The harmonic
number at a half-whole n is exact for m = 1 and an even m, from the
same values with Euler's constant left out, since it cancels:
harmonicnumber(1/2) is 2 - 2 ln 2.
Part of #2182
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2204 +/- ##
==========================================
- Coverage 86.57% 86.55% -0.03%
==========================================
Files 301 301
Lines 66764 66807 +43
Branches 19372 19389 +17
==========================================
+ Hits 57801 57824 +23
- Misses 4874 4890 +16
- Partials 4089 4093 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #2182.
eulergammais Euler's constant, the Euler–Mascheroni constant γ = 0.5772156649…, the one constant the register lists.piande: evaluated to the working precision (Brent and McMillan, the routineEiandCialready used), in the interval and decimal evaluators, and in both compilers.EulerGamma, the Mathematica and SymPy name, is read as it too.γstays a variable, andgammais still the Γ function.\mathrm{\gamma}and exports assympy.EulerGamma.e:sum(eulergamma, eulergamma, 1, 3)is6.With it, values that had no closed form become exact:
Simplifydigamma(1)digamma(1)-eulergammadigamma(3)digamma(3)3/2 - eulergammadigamma(1/2)digamma(1/2)(-2) * ln(2) - eulergammaharmonicnumber(1/2)harmonicnumber(1/2)2 - 2 * ln(2)harmonicnumber(1/2, 2)harmonicnumber(1/2, 2)4 - 1/3 * pi ^ 2That is
psi(1) = -gammaandpsi(1/2) = -gamma - 2 ln 2(DLMF 5.4.12, 5.4.13) and the recurrence from either.harmonicnumber(n, m)at a half-wholenis exact form = 1and an evenm. An oddmfrom 3 needszeta(3)and stays as written.Tests:
EulerGammaTest. The value is checked against mpmath to 100 and 150 digits, and every exact digamma and harmonic value against mpmath's to 30 digits.Full suite 17835/0, interactive trio, AOT smoke 64/0, all frameworks build.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura