Skip to content

A special function of a logarithm of a monomial is integrated, through Ei of a complex argument - #1645

Merged
Rafael-SOWNet merged 3 commits into
masterfrom
an-exponential-times-a-sine-over-a-linear
Oct 1, 2026
Merged

Rafael-SOWNet merged 3 commits into
masterfrom
an-exponential-times-a-sine-over-a-linear

Conversation

@Rafael-SOWNet

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

Copy link
Copy Markdown
Member

(e x)^m Si(d (a + b ln(c x^n))) is by parts against (e x)^m, and what is left is a power of x times sin(d (a + b ln(c x^n)))/(a + b ln(c x^n)). Two rules were missing on the way, and both are here.

  • A function of one logarithm of a monomial. x^m G(ln(c x^n)) is integrated under t = ln(c x^n). dx is x dt/n, and x^(m + 1) is K e^((m + 1) t/n) with K = x^(m + 1) (c x^n)^(-(m + 1)/n), whose derivative is 0 wherever it is defined. So the answer is K/n times the integral of e^((m + 1) t/n) G(t) at t = ln(c x^n). That is an antiderivative wherever the integrand is real. For an even n that includes negative x, where ln(c x^n) is not ln(c) + n ln(x) and an answer through ln(x) would be off by a branch. A power of a monomial, (e x)^m, is x^m times a factor of the same kind. Rubi's answers to 8.3–8.5 are written in this K. The integral in t is asked as one quotient, as the logarithm substitution asks its own: as a product, (d x)^m x/ln(b x) handed over e^((m + 2) t) t^(-1), which ran away in integration by parts (Integrating e^(2x) x^(-1) runs out of memory: integration by parts reads x^(-1) as a polynomial #1646, fixed by A negative power of the variable is not a polynomial to integration by parts #1647). As a quotient it is Ei((m + 2) t) at once, and (d x)^m li(b x) is answered too, since by parts leaves (d x)^m x/ln(b x) of it.
  • An exponential beside sines and cosines, over linears. Each sine and cosine is written as exponentials and the product multiplied out. Every term is then an exponential with a complex rate over the linears, which the exponential rules answer with Ei of a complex argument. e^(2x) sin(x)/x is (Ei((2 + i) x) - Ei((2 - i) x))/(2i), two conjugate terms whose sum is real. This applies only with an exponential beside the sine or cosine: sin(x)/x alone stays Si(x).

The evaluator already reads Ei, Si and erf off the real line, so these answers are checked like any other. Ei(1 + 2i) evaluates to 1.0421677… + 3.7015014… i.

Measured

Input Was (2.5.0) Now
"e^(2*x)*sin(x)/x".Integrate("x") integral(e ^ (2 * x) * sin(x) / x, x) (-1/2 * i) * Ei((2 + i) * x) + 1/2 * i * Ei((2 - i) * x) + C
"x*sin(ln(x))/ln(x)".Integrate("x") integral(x * sin(ln(x)) / ln(x), x) (-1/2 * i) * Ei((2 + i) * ln(x)) + 1/2 * i * Ei((2 - i) * ln(x)) + C
"cos(a+b*ln(c*x^n))^2".Integrate("x") integral(cos(a + b * ln(c * x ^ n)) ^ 2, x) an antiderivative in sin and cos of 2 (a + b ln(c x^n)), beside x (c x^n)^(-1/n)
  • Rubi, master at 492afc23 and this change on it, run side by side, 0 wrong everywhere:
    • Family 8: 395 → 411 of 420:
      • all fifteen of F(d (a + b ln(c x^n))): Ei, Shi and Chi beside (e x)^m, and Si and Ci alone, beside x, x^2 and (e x)^m, and over x^2 and x^3;
      • (d x)^m li(b x), Rubi's 8.3 row 269.
    • Family 4 at ten a file: 611 → 612, the one being cos(a + b ln(c x^n))^2.
    • Family 2: 544 of 650 on both.
    • Family 3 at twenty a file: 171 of 180 on both.
    • The independent suites: 1756 of 1814 on both.
    • Families 1, 5, 6 and 7 at five a file: 437 of 499 on both.
  • Run alone, the seventeen are 0 of 17 on master and 17 of 17 here.
  • The unit tests pass on 6a4b09c1, this change on 492afc23: 14,275, none failed (net10.0), with the GC heap held to 4 GB. Rebased onto master with A negative power of the variable is not a polynomial to integration by parts #1647, the integration test classes pass (199).
  • The native AOT publish of the C++ wrapper builds with no trim or AOT warnings.
  • The performance gate passes on 6a4b09c1. Allocation matches the baseline on all 19 gated benchmarks.

ExponentialIntegralIntegrationTest has three rows of an exponential beside a sine or cosine over a linear. It also has four of a function of a logarithm of a monomial, checked at negative x as well with n = 2, and (k x)^m x/ln(b x) past 1. SpecialFunctionsByPartsTest checks (d x)^m li(b x) at positive points, where li(b x) is real.

Part of #1501.

🤖 Generated with Claude Code

@Rafael-SOWNet

Copy link
Copy Markdown
Member Author

On hold, and back to draft: (d x)^m x/ln(b x) runs out of memory with this change. The new rule hands the integrator e^((m + 2) t) t^(-1), and master runs away on that spelling too (#1646). I will push the integrand built as one quotient, re-measured, and mark this ready again.

Rafael-SOWNet and others added 3 commits October 1, 2026 11:14
…h Ei of a complex argument

(e x)^m Si(d (a + b ln(c x^n))) is by parts against (e x)^m, and what is left is a power of x
times sin(d (a + b ln(c x^n)))/(a + b ln(c x^n)). Two rules were missing on the way, and both are
here.

A power of x times a function of one logarithm of a monomial, x^m G(ln(c x^n)), is integrated
under t = ln(c x^n). dx is x dt/n, and x^(m + 1) is K e^((m + 1) t/n), where
K = x^(m + 1) (c x^n)^(-(m + 1)/n) has derivative 0 wherever it is defined. So the answer is K/n
times the integral of e^((m + 1) t/n) G(t) at t = ln(c x^n), an antiderivative wherever the
integrand is real. For an even n that includes negative x, where ln(c x^n) is not ln(c) + n ln(x)
and an answer through ln(x) would be off by a branch. A power of a monomial, (e x)^m, is x^m times
a factor of the same kind. Rubi's answers to 8.3 to 8.5 are written in this K.

And an exponential times sines and cosines of linears over linears: each sine and cosine is
written as exponentials, the product multiplied out, and every term is an exponential with a
complex rate over the linears, which the exponential rules answer with Ei of a complex argument.
e^(2x) sin(x)/x is (Ei((2 + i) x) - Ei((2 - i) x))/(2i), two conjugate terms whose sum is real.
Only with an exponential beside the sine or cosine: sin(x)/x alone stays Si(x). The evaluator
reads Ei, Si and erf off the real line already, so these answers are checked like any other.

Measured on the Rubi corpus, master at 9efc486 and this change on it, run side by side: family 8
394 -> 409 of 420, all fifteen of F(d (a + b ln(c x^n))): Ei, Shi and Chi beside (e x)^m, and Si and
Ci alone, beside x, x^2 and (e x)^m, and over x^2 and x^3. Family 4 at ten a file 611 -> 612, the
one being cos(a + b ln(c x^n))^2. Family 2 is 544 of 650 on both, family 3 at twenty a file 173 of
180, the independent suites 1756 of 1814, and families 1, 5, 6 and 7 at five a file 439 of 499.
0 wrong everywhere. Run alone, the sixteen are 0 of 16 on master and 16 of 16 here. The unit tests
pass, 14,272.

The unit tests pass, 14,273, with the GC heap held to 4 GB, and the performance gate passes on
49f87185, which is this change on 9efc486 but for K written as 1 where the logarithm is ln(x):
allocation is what the baseline says on all 19 gated benchmarks.

ExponentialIntegralIntegrationTest has three rows of an exponential beside a sine or cosine over a
linear, and four of a function of a logarithm of a monomial, checked at negative x as well with
n = 2.

Part of #1501.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SolveByAPowerAndALogarithmOfAMonomial built its integrand in t as a product: for (d x)^m x/ln(b x)
that is e^((m + 2) t) t^(-1), which the exponential integral rules do not read, and which runs away
in integration by parts on master (#1646). Built with SingleQuotient.Combine, as the logarithm
substitution builds its own, (d x)^m x/ln(b x) is K Ei((m + 2) ln(b x)) in 0.3 s, and
(d x)^m li(b x), Rubi's 8.3 row 269, is answered in 0.8 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet
Rafael-SOWNet force-pushed the an-exponential-times-a-sine-over-a-linear branch from 6a4b09c to 7717217 Compare October 1, 2026 11:15
@Rafael-SOWNet
Rafael-SOWNet marked this pull request as ready for review October 1, 2026 11:15
@Rafael-SOWNet

Copy link
Copy Markdown
Member Author

Ready again. The integral in t is now asked as one quotient (b6f0d99), so (d x)^m x/ln(b x) is Ei((m + 2) ln(b x)) at once, and (d x)^m li(b x) is answered as well. Re-measured against master at 492afc2: family 8 395 → 411 of 420, family 4 at ten a file +1, the rest unchanged, 0 wrong. The suite and the gate pass. Rebased onto master with #1647.

@Rafael-SOWNet
Rafael-SOWNet merged commit dcf5ba7 into master Oct 1, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant