Repository navigation
Exponentials of quadratics beside sines, cosines and hyperbolic functions of quadratics are integrated onto the Gaussian - #1521
Merged
Conversation
…ions of quadratics are integrated onto the Gaussian A product of exponentials of polynomials of degree at most two, whole powers of sines and cosines of such polynomials, whole powers of sums of those exponentials (the hyperbolic functions) and a polynomial, where some exponent is a quadratic: with each sine or cosine written as exponentials of i times its argument and the product multiplied out, every term is k P(x) e^(Q(x)) with Q of degree at most two, the Gaussian's moments where Q is a quadratic and elementary where it is not. A term's exponent is kept as whole multiples of the exponents the integrand writes, so that e^(i q) e^(-i q) is decidably e^0. Rubi's 4.7.6, 6.1.5 and 6.2.5, 6.1.4's x^2 sinh(a + b x + c x^2)^2, and 2.3's f^(q1) g^(q2). Part of #1501. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Rafael-SOWNet
added a commit
that referenced
this pull request
Sep 27, 2026
…er templates kept Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
This was referenced Sep 27, 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.
Part of #1501.
A product of exponentials of polynomials of degree at most two, whole powers of sines, cosines and hyperbolic functions of such polynomials, and a polynomial is now integrated when some exponent is a quadratic. Each sine or cosine is written as exponentials,
sin(q) = (e^(i q) - e^(-i q))/(2i). Multiplied out, the product is a sum of termsk P(x) e^(Q(x)), withQof degree at most two. WhereQis a quadratic, a term is the Gaussian's moments, which #1512 and #1519 answer. Otherwise it is elementary. A hyperbolic function is already written as exponentials, so it needs no rewriting.The answer for a real integrand with a sine or cosine in it is written with the imaginary unit, as Rubi's is:
A sine or cosine is taken only beside an exponential. On its own, or beside a polynomial only, the sine of a quadratic is a Fresnel integral, which this does not write. And
x sin(x^2)still gives-cos(x^2)/2, by the substitution, with no imaginary unit in it.f^(a + b x + c x^2) trig(d + e x + f x^2)^n,n= 1, 2, 3, every combination of linear and quadratic (Rubi's 4.7.6)erforerfisinhorcosh(6.1.5, 6.2.5)x^2 sinh(a + b x ± c x^2)^2,(d + e x)^2 sinh(a + b x + c x^2)^2and theircoshtwins (6.1.4, 6.2.4)e^(asin(a x)^2) x^m, after the integrator's ownu = asin(a x)(5.1.5)f^(a + b x + c x^2) g^(d + e x + f x^2)(2.3)x sin(x^2),e^x sin(2x),e^(2x) cos(x)^2Exact cancellation
A term's exponent is kept as whole multiples of the exponents the integrand writes, not as their sum. So
e^(i q) e^(-i q)is the multiple 0, decided in integers. The first version added the exponents, andInnerSimplifieddoes not readi q + (-i) qas zero. The cross term ofcos(q)^2was then taken for a Gaussian with a zero square coefficient, and came back asNaN. For the same reason, a zero coefficient is never multiplied byln(f): simplified,0 ln(f)is0 provided not f = 0, which does not test as zero either.Not yet
x^2 sinh(a + b x^2)^3andsinh(a + b x^2)^3/x^2are still declined: a polynomial, or a power ofxbelow the bar, beside a term whose exponent has no linear part. A follow-up takes both.Cost
The rule is asked of every product the integrator meets. It first counts the factors by their written shape, which reads and allocates nothing. It declines there unless there is a sine beside an exponential, two exponentials, or a power of a sum.
Measured
erf,erfcorerfi: 811 across families 0 to 7, at a 3 s budget. This PR solves 720, where master (22021b1c) solves 593, with 0 wrong and nothing lost. Timeouts go from 14 to 3, with none new. The total time goes from 574 s to 298 s, mostly the sections whose declines this answers. The 127 gained are 64 in 4.7.6, 24 in 6.1.5, 24 in 6.2.5, 8 in 5.1.5, 3 in 6.1.4, 3 in 6.2.4 and 1 in 2.3. That makes 4.7.6, 6.1.5, 6.2.5 and 5.1.5 complete: 64/64, 29/29, 29/29 and 8/8. The slowest problem gained now takes 1.1 s.🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura