Skip to content

Integrate the upper incomplete gamma function beside a power or a polynomial - #2078

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
integrating-the-incomplete-gamma-function
Oct 22, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
integrating-the-incomplete-gamma-function

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Integrates the upper incomplete gamma function of a linear beside a polynomial or a power of x, by parts. Part of #2075, on top of #2077's node.

The derivative of Gamma(n, u) is -b u^(n - 1) e^(-u) for u = a + b x, and with the antiderivative Q of what is beside it written in powers of u, each u^k lands on u^(n + k - 1) e^(-u), which is the derivative of -Gamma(n + k, u):

  • Beside a polynomial, with an offset: int P(x) Gamma(n, a + b x) dx = Q Gamma(n, u) - sum_k q_k Gamma(n + k, u). For a power (c + d x)^k it is Rubi's form, in b c - a d.
  • Beside a power of a multiple of x, any exponent but -1, without an offset: int x^m Gamma(n, b x) dx = x^(m + 1) Gamma(n, b x)/(m + 1) - x^m (b x)^(-m) Gamma(m + n + 1, b x)/(b (m + 1)). x^m (b x)^(-m) is b^(-m) only for a whole m. Elsewhere the two powers take their branches separately, and the product is constant only between the cuts.

Not beside 1/x, whose integral is a hypergeometric function, nor beside a power of a different linear, which Rubi leaves unintegrated too.

Rubi 8.6, 177 problems
#2077's node alone 63 solved, 111 unsolved, 3 timeouts
with this PR 144 solved, 30 unsolved, 3 timeouts, 0 wrong

Measured with a copy of the corpus harness that reads Maxima's GAMMA(a, x) as gamma(a, x). The shared harness does not read it yet, so its figures would not move. On the shared harness, the whole corpus is 48,305/48,305 at fde0ca12, with no row moved and no answer's allocation grown (0.985–0.999× of the baseline across the three streams).

The 33 rows left:

  • 15: the integrand is rewritten before this rule sees it. A whole order and 1/2 are elementary, so (d x)^m Gamma(3, b x) arrives as (d x)^m e^(-b x) times a quadratic, which needs x^m e^(-b x) as a gamma function. That is the next PR.
  • 12: Gamma(n <= 0, a + b x)/(c + d x)^k. These need by parts against something other than a polynomial.
  • 6: a gamma function of a logarithm.

The function's derivative and the power's real root. The kernel takes the principal branch of z^a. The derivative -z^(a - 1) e^(-z) goes through the power, and on a negative base the power takes the real root for an exact exponent of odd denominator below 10 (#204). So at a negative z, for such an a, the derivative evaluated is not the derivative of the value. MathS.IncompleteGamma's documentation says so. The tests here differentiate back where the integrands are real, and on the cut only for whole orders beside whole powers, where no such power appears.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

…ynomial

By parts against the antiderivative Q of what is beside it. The derivative of
Gamma(n, u) is -b u^(n - 1) e^(-u) for u = a + b x, so with Q written in powers of
u each u^k lands on u^(n + k - 1) e^(-u), the derivative of -Gamma(n + k, u).
Beside a polynomial with an offset that is Q Gamma(n, u) - sum_k q_k Gamma(n + k, u),
in Rubi's b c - a d for a power of a linear. Beside (d x)^m without one, for any m
but -1, it is x^(m + 1) Gamma(n, b x)/(m + 1) - x^m (b x)^(-m) Gamma(m + n + 1, b x)/
(b (m + 1)), where x^m (b x)^(-m) is b^(-m) for a whole m only.

Rubi's 8.6, read with a harness copy that maps Maxima's GAMMA(a, x): 63 of 177
solved with the node alone, 144 with this, 0 wrong. The shared harness does not
read GAMMA and its corpus stays at 48,305/48,305 with no row moved.

MathS.IncompleteGamma now says that its derivative, read through the power, takes
the real root at a negative z for an exact order of small odd denominator, where
the value takes the principal branch (#204).

Part of #2075.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant