Skip to content

Integrate a power beside an exponential of a power as an incomplete gamma function - #2083

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-power-beside-an-exponential-as-a-gamma-function
Oct 23, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-power-beside-an-exponential-as-a-gamma-function

Conversation

@Rafael-SOWNet

@Rafael-SOWNet Rafael-SOWNet commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Answers ∫ x^m F^(a + b x^n) dx and ∫ (c + d x)^m F^(a + b x) dx with the upper incomplete gamma function, where that is what the integral is. Part of #2075; answers #180's item 22, t^(-1/2) e^(-t^(-2)).

The rule. With z = -b ln(F) x^n and s = (m + 1)/n, x^(m + 1) z^(-s) is constant between the cuts and gamma(s, z) differentiates to -z^(s - 1) e^(-z) z', so the integral is -F^a x^(m + 1) z^(-s) gamma(s, z)/n. The second shape is the first with n = 1 under t = c + d x.

  • Where it applies: where s is neither whole nor half a whole number. Those integrals are elementary, exponential integrals or error functions, and keep the answers they had.
  • Past 30: a whole or half-whole s is the gamma function, where parts would take s steps. x^100 e^(-a x) is -a^(-101) gamma(101, a x).
  • Where the constant factor is one number on both half-lines, it is written as that number, and the answer has a value at 0: e^(x^3) is gamma(1/3, -x^3)/3.

Two costs it exposed, each fixed here.

  • Slow declines. By parts integrated (a + b ln(c x^n))^p into a gamma function of a logarithm and handed on a remainder that nothing integrates. The searches then sampled it three thousand times before declining, and 29 declines in the 3.x files became timeouts (one went from 2.7 s to 116 s). Three by-parts paths now decline a gamma function of an argument that is not linear. Evaluate the incomplete gamma function's series faster #2079 made each evaluation ten times cheaper too.
  • A definite integral through 0. For x^2 e^(x^4) from 0, the answer is 0 times an infinity at the bound. Its limit went through l'Hôpital's rule on the whole product for over a minute, and it is left as written there, as master leaves it. Γ's own limit is taken by continuity where its value is finite. limit(gamma(-1, x), x, 0) stays undecided, since the function is about 1/x there.

Measured on Rubi's suite, read with the harness that maps GAMMA and Psi, against master e62a56d6, the whole corpus each side:

master this
solved 48,502 of 49,052 48,634
wrong 0 0
timeouts 5 2
rows lost 0

The gains are 68 in 2.3, 24 in 3.1.2, 12 in 8.6, 7 each in 3.3 and 3.5, 6 in 3.1.5, and 8 elsewhere. Time and allocation per stream are within 3%. Two rows' allocation grew in the run, 3.3:246 and 7.3.6:563, and alone they are identical on both builds: 2.46 GB and 1.43 GB.

Checked by value, not only by differentiating back, since a derivative that matches is what hid #2080's wrong values:

this quadrature
integral(e^(x^3), x, 0, 1) 1.3419044179774… 1.34190441797742
integral(e^(x^2)*x^(1/3), x, 0, 1) 1.1717955466629… 1.17179554666298
integral(x^2*e^(x^4), x, 1, 2) 1129720.502623949… 1129720.50262395
integral(floor(x)*e^(x^3), x, 0, 2) 275.5109837633… 275.510983763312

Four tests changed, each because an integral they pinned as declined is answered now. Each new answer is checked by its value. A fifth, (pe x)^(n - 1) e^(x^n) with its pe > 0, failed on the first version and passes unchanged since the order is read through Simplify:

  • e^(x^3) in the ansatz's decline list is replaced by e^(x^3 + x), which is neither elementary nor a gamma function.
  • floor(x) e^(x^3) over [0, 2] moves to a test of its value. e^(x^3 + x) takes its place among the integrals left as written.
  • x^m ln(x)^n (1 + ln x) is differentiated back.
  • x^n e^(x^n) is differentiated back.

The suite passes (16,923) and so do the MCP tests (329).

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

…amma function

int x^m F^(a + b x^n) dx is -F^a x^(m + 1) z^(-s) gamma(s, z)/n with z = -b ln(F) x^n
and s = (m + 1)/n, and int (c + d x)^m F^(a + b x) dx the same with n = 1 under
t = c + d x: x^(m + 1) z^(-s) is constant between the cuts, and gamma(s, z)
differentiates to -z^(s - 1) e^(-z) z'. Only where s is neither whole nor half a
whole number, whose integrals are elementary, exponential integrals or error
functions and keep those answers, or where it is past 30, where parts would take s
steps: x^100 e^(-a x) is -a^(-101) gamma(101, a x). Where the constant factor is
one number on both half-lines it is written so, and the answer has a value at 0:
e^(x^3) is gamma(1/3, -x^3)/3.

Two costs this exposed, each fixed here. By parts integrated (a + b ln(c x^n))^p
into a gamma function of a logarithm and handed its remainder on, which nothing
integrates and the searches sampled thousands of times: three by-parts paths now
decline a gamma function of an argument that is not linear. And a definite
integral of an answer undefined at a bound, x^2 e^(x^4) from 0, took a limit
through l'Hopital's rule for over a minute; it is left as written there. gamma's
own limit is taken by continuity where its value is finite.

The order is read through Simplify where its symbols cancel: (-1 + n + 1)/n is 1,
and (p x)^(n - 1) e^(x^n) keeps its elementary answer.

Rubi's suite on the harness that reads GAMMA, against master e62a56d:
48,502 -> 48,634 of 49,052, 0 wrong, 0 rows lost, timeouts 5 -> 2; the gains are
68 in 2.3, 24 in 3.1.2, 12 in 8.6 and the logarithm files. Two rows' allocation grew
in the run and is identical alone on both builds.
Four tests that pinned a decline answer now, each checked by value.

Part of #2075; answers #180's item 22.

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