Skip to content

A constant plus an imaginary cosine and sine is an exponential - #1766

Merged
Rafael-SOWNet merged 2 commits into
masterfrom
a-constant-plus-an-imaginary-cosine-and-sine-is-an-exponential
Oct 5, 2026
Merged

Rafael-SOWNet merged 2 commits into
masterfrom
a-constant-plus-an-imaginary-cosine-and-sine-is-an-exponential

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #718.

(A + B cos(x))/(a + b cos(x) + i b sin(x)) was declined, with the rest of Rubi's 4.7.7 over a + b cos(x) ± i b sin(x). 2.5.0 declined them too:

integrand 2.5.0 master 763f7bae this
(k + q cos(x))/(a + b cos(x) + i b sin(x)) declined declined after 1.9 s logarithms of a + b e^(i x) and a term in e^(-i x), piecewise in whether a and b are zero, in 1.1 s
(k + q sin(x))/(a + b cos(x) - i b sin(x)) declined declined in 0.7 s
(k + p cos(x) + q sin(x))/(a + b cos(x) + i b sin(x)) declined declined after 1.2 s in 1.8 s
cos(x)/(a + b cos(x) + i b sin(x)) declined declined -i ln(b (a + b e^(i x)))/(2b) and a term in e^(-i x), in 0.2 s

Each answer is differentiated back with a = 2.3, b = 0.9, k = 1.1, p = 0.4, q = 0.6 and compared at x = -2.3, -1.1, -0.4, 0.4, 1.1, 2.3, as complex numbers; the times include that. The answers run from 128 to 1,477 characters.

What changes. b cos(y) + i b sin(y) is b e^(i y), and the rule that writes such a pair below the bar as its exponential, SolveByWritingAnImaginarySumOfACosineAndASineAsAnExponential, read the pair alone. It reads it beside a constant now, a + b e^(i y), and there writes the cosine and sine of y elsewhere in the integrand as exponentials too, so that the whole is rational in e^(i y). Without a constant, a cosine above the bar stays as it is, beside the exponential the closed rules answer. 1/(a + b cos(x) + i b sin(x)), which master answers by the half-angle tangent, is answered in the exponential now.

Tests: ConstantPlusAnImaginaryCosineAndSineIntegralTest, four rows compared as complex numbers; master declines all four.

Measured first on all of Rubi's 4.7.7, 836 problems, at the corpus's 5-second budget, against master 287c69a7, the branch's base:

master this
solved 691 699
wrong 0 0
past the budget 21 21

Measured then on the Rubi corpus against master 287c69a7:

master this
family 0, independent suites (1814) 1772 1772
family 1, 40 a file (1381) 1308 1307
families 2 to 8, sampled (2410) 2301 2299

The harness counts no answer wrong in the pocket or the sample on either build. The family figures were measured with three other corpus runs on the machine. Of the 13 problems the two builds disagreed on, pocket and sample together, run again one build at a time, master answers 1 and this 10: eight are 4.7.7's quotients by a + b cos(x) ± i b sin(x), each in two seconds or less, where master declines them, and one is a 1.1.2.4 rational function at twenty-three seconds, at the edge of the harness's patience, which master ran past. Both builds answer the other one, and both run past the budget on the remaining three.

The suite on the commit measured, 613216e1, passed but for two tests that bound how long a declined integral takes, IntegralAnswerCacheTest.AnIntegralWithNoAnswerStillFinishesQuickly at thirty-one seconds and InverseTangentPowerByPartsTest.ANonElementaryRemainderIsDeclinedQuickly at sixty-five, with four other corpus runs on the machine; alone, the two classes pass in twelve seconds. The allocation gate passed. The head here, 228dd45d, merges master 763f7bae, and every row of the first table is as it says on it.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 2 commits October 4, 2026 18:13
a + b cos(y) + i b sin(y) is a + b e^(i y): the rule that writes the
pair below the bar as the exponential reads it beside a constant, and
there writes the cosine and sine of y elsewhere as exponentials too, so
that the whole is rational in e^(i y). Without a constant the cosine
above the bar stays, beside the exponential the closed rules answer.
Rubi's (A + B cos(x))/(a + b cos(x) + i b sin(x)) and its kin were
declined.

Part of #718.

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 18038b0 into master Oct 5, 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