Skip to content

A trigonometric function of an imaginary multiple of a logarithm is integrated in exponentials - #1744

Merged
Rafael-SOWNet merged 5 commits into
masterfrom
a-trigonometric-function-of-an-imaginary-logarithm
Oct 4, 2026
Merged

Rafael-SOWNet merged 5 commits into
masterfrom
a-trigonometric-function-of-an-imaginary-logarithm

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #718.

tan(a + i ln(x)) and sin(a + ln(c x^2) sqrt(-1/4)) were declined: the closed form for a power of the variable times a sine or cosine of a logarithm divides by (m + 1)^2 + B^2, which an imaginary B can make zero, and Rubi's 4.7.5 builds 66 problems on exactly that. 2.5.0 declined them too:

integrand 2.5.0 master 3f744439 this
sin(a + ln(c x^2) sqrt(-1/4)) declined declined answered
tan(a + i ln(x)) declined declined answered
cot(a + i ln(x))/x^2 declined declined answered
1/cos(a - 2 i ln(c x))^(3/2) declined declined answered
x sin(a + ln(c x^n) sqrt(-1/n^2))^2 declined declined declined
cos(a + ln(c x^n) sqrt(-1/(4 n^2)))^2 declined declined declined
sin(a + ln(c x^n) sqrt(-1/n^2)) declined declined declined

Each answer is differentiated back with the symbols pinned and compared as a complex number at six points.

What changes. e^(i (a + b ln(u))) is e^(i a) times a real power of u when b is imaginary, so each trigonometric function of such an argument is a sum or quotient of powers of u. Where b is an imaginary number they are written so, through Euler's formula, and the question asked again: the zero the closed form divides by is a power 1/x there, whose integral is a logarithm. After the closed form, which answers every real b. A symbolic b, sqrt(-1/n^2), is left alone: whether the zero is there turns on the sign of n, and the general power's formula, written without knowing it, has a zero below its bar. Beside its own derivative the logarithm is left to the substitution: tan(a + i ln(x))/x is tan(a + i u) in u = ln(x), which the integrator answers in a closed form, where the exponentials would answer it as a piecewise in e^(i a).

Tests: TrigonometricOfAnImaginaryLogarithmIntegralTest, five rows compared as complex numbers; four are declined on master, and the fifth is answered there by another route. Two more, tan(a + i ln(x))/x and cot(a + i ln(x))/x, keep the substitution's answer, and fail without the step that leaves them to it.

Measured first on the 72 problems of 4.7.5 with an imaginary multiple of a logarithm in a trigonometric function, 66 run, at the corpus's 5-second budget, against master 8f3757cd, the branch's base:

master this
solved 4 27
wrong 0 0
past the budget 1 2

Seven more are answered and not counted. Six, x tan(a + i ln(x)) and its kin with x, x^3 or 1/x^3 beside the tangent or the cotangent, are answered in a piecewise in e^(i a) whose conditions hold e^(-i a) e^(i a) as written; the harness evaluates them once Simplify has made that 1, and they check out then. The seventh, 1/sin(a - 2 i ln(c x))^(3/2), is answered provided e^a > 0, which the harness does not evaluate with its pinned symbols; its derivative matches the integrand to 1e-23 at eight points on both sides of zero, by central differences in mpmath at 40 digits. cot(a + i ln(x))^2/x^3, past the budget here, is answered in four and a half seconds alone. The 30 still declined have a symbolic coefficient, sqrt(-1/n^2), sqrt(-(1 + m)^2/n^2) and their kin, 26 of them, or a symbolic power, sec(a + i ln(c x^n)/(n (p - 2)))^p and its kin, four.

Measured then on the Rubi corpus against master 8f3757cd:

master this
family 0, independent suites (1814) 1766 1766
family 1, 40 a file (1381) 1296 1295
families 2 to 8, sampled (2410) 2215 2218

The harness counts no answer wrong in the pocket or the sample on either build. Of the 37 problems the two builds disagreed on, pocket and sample together, run again one build at a time, master answers 5 and this 26: twenty-four of 4.7.5's that master declines in a tenth of a second to a second, answered here in a tenth of a second to eighteen seconds, and the two with 1/x beside the function, tan(a + i ln(x))/x and cot(a + i ln(x))/x, which both answer in under a tenth of a second. The three master answers there and this does not, (a + b x)^10 (A + B x)/(d + e x)^9, 1/(x (a x + b x^3 + c x^5)^2) and log(e (f (a + b x)^p (c + d x)^q)^r)/(a + b x)^4, take twenty to twenty-four seconds on master, at the edge of the harness's patience, and ran past it here under a heavier load; family 1's one in the sample is the first. Seven more of the 37 are the seven above that the harness does not count, and x^4/((a + b x^2)^2 (c + d x^2)^3) is past the budget on both.

The suite passes on the commit measured, 1924669c, 14,596 tests with 13 skipped, and the allocation gate with it. The pocket and the 37 moved problems were run again with the step that leaves a logarithm beside its derivative to the substitution, 38f87001, which is what the counts above are; the families were measured before it, and it changes only an integrand with the logarithm's derivative beside it, two of the pocket's. On the merge with master 7075a747, 7d23e936, the 4,104 calculus and corpus tests that run pass, with 2 skipped; on the merge with master 3f744439, cedda6a2, this file's tests, #1743's and the corpus gate pass, 23 of them. Every row of the first table is as it says on the merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 5 commits October 4, 2026 08:11
…ntegrated in exponentials

tan(a + i ln(x)) and sin(a + ln(c x^2) sqrt(-1/4)) were declined: the
closed form for a power of the variable times a sine or cosine of a
logarithm divides by (m + 1)^2 + B^2, which an imaginary B can make
zero, and Rubi's 4.7.5 is built on exactly that. e^(i (a + b ln(u))) is
e^(i a) times a real power of u when b is imaginary, so each function is
written as a sum or quotient of such powers when b is an imaginary
number; a symbolic b is left alone, since whether the zero is there
turns on a sign.

Part of #718.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
…ubstitution's answer

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet Rafael-SOWNet added this to the 2.6.0 milestone Oct 4, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit 1aacd4d into master Oct 4, 2026
34 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