Repository navigation
Evaluate the incomplete gamma function's series faster - #2079
Merged
Rafael-SOWNet merged 1 commit intoOct 22, 2026
Merged
Conversation
Gamma(a, z) by its series is Gamma(a) - gamma(a, z), and Gamma(a) was computed by Spouge's approximation on every evaluation: six of the nine milliseconds at a hundred digits. It is remembered now, per order and precision, since a function the integrator samples at points is asked it at one a for every z. A real a and z sum the series in real arithmetic, one product and one quotient a term where the complex arithmetic took nineteen operations, and the logarithm on the cut takes pi from the cache rather than computing it afresh. gamma(2.91, -3.3) 9.52 -> 0.92 ms, gamma(1/3, 2) 23.0 -> 2.2 ms, gamma(1/2 + i, 2 + 3i) 11.8 -> 2.7 ms; the continued fraction and the exponential integral's series are unchanged. Found by #2075's next integration rule, whose answers one declined integral sampled three thousand times. Part of #2075. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
This was referenced Oct 23, 2026
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.
Makes the upper incomplete gamma function's series several times cheaper. Part of #2075.
Gamma(a, z)by its series isGamma(a) - gamma(a, z), andGamma(a)was computed by Spouge's approximation on every evaluation: six of the nine milliseconds at a hundred digits.Gamma(a)is remembered, per order and precision. A function the integrator samples at points is asked it at oneafor everyz.aandzsum the series in real arithmetic. That is one product and one quotient a term, where the complex arithmetic took nineteen operations.pifrom the cache rather than computing it afresh.Measured on one machine, 40 evaluations each, at the default hundred digits, against master
b21f0138:gamma(2.91, -3.3)gamma(2.91, 3.3)gamma(12/5, -30)gamma(7.71, 2.1)gamma(1/3, 2)gamma(37/10, -7/3 + 2i)gamma(1/2 + i, 2 + 3i)gamma(0, -30), the exponential integral's seriesgamma(5/2, 40), the continued fractionValues are unchanged: the 37 tests against mpmath's
gammaincat 55 digits pass, and so does the suite (16,890) and the MCP tests (329).Found by #2075's next integration rule. Its answers carry the function, and one declined integral sampled them three thousand times.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura