Skip to content

A cosine and a sine over a power of another such sum are integrated through its derivative - #1763

Merged
Rafael-SOWNet merged 5 commits into
masterfrom
a-cosine-and-a-sine-over-a-power-of-another
Oct 4, 2026
Merged

Rafael-SOWNet merged 5 commits into
masterfrom
a-cosine-and-a-sine-over-a-power-of-another

Conversation

@Rafael-SOWNet

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

Copy link
Copy Markdown
Member

Part of #718.

sin(x)/(a + b cos(x) + c sin(x)) was declined, with the rest of Rubi's 4.7.7 quotients of A + B cos(x) + C sin(x) by a whole power of a + b cos(x) + c sin(x); master answers the squares and cubes after twenty seconds or so, and 1/(a + b cos(x) + c sin(x))^2 with coefficients past the fiftieth degree in the symbols. 2.5.0 declined them:

integrand 2.5.0 master a10be86c this
sin(x)/(a + b cos(x) + c sin(x)) declined declined c x/(b^2 + c^2) - b ln(a + b cos(x) + c sin(x))/(b^2 + c^2) and the half-angle answer for 1/S, piecewise in the sign of a^2 - b^2 - c^2, in 0.6 s
(k + q cos(x))/(a + b cos(x) + c sin(x)) declined declined in 0.09 s
(k + p cos(x) + q sin(x))/(a + b cos(x) + c sin(x))^2 declined answered in 27 s in 0.2 s
(p cos(x) + q sin(x))/(a + b cos(x) + c sin(x))^3 declined answered in 19 s in 0.7 s
1/(a + b cos(x) + c sin(x))^2 declined answered in 5.7 s, a^59 among the coefficients in 0.07 s

Each answer is differentiated back with a = 2.3, b = 0.9, c = 0.7, k = 1.1, p = 0.6, q = 0.8 and compared at x = -2.6, -1.6, -0.4, 0.4, 1.4, 2; the times include that.

What changes. With S the base and S' = c cos(y) - b sin(y), the numerator is alpha S + beta S' + gamma, matching the cosine, the sine and the constant: alpha = (B b + C c)/(b^2 + c^2), beta = (B c - C b)/(b^2 + c^2), gamma = A - a alpha. beta S'/S^n integrates to a logarithm or a power of S. For the powers, with T = b sin(y) - c cos(y) = -S', T^2 = b^2 + c^2 - (S - a)^2 gives d/dy (T S^m) = (1 + m) S^(m+1) - a (1 + 2m) S^m + m (a^2 - b^2 - c^2) S^(m-1), which for m = 1 - k writes int S^(-k) through int S^(1-k) and int S^(2-k), down to int 1/S, which the half-angle tangent answers as before, and y. Exact as that answer is: a linear combination and an identity of derivatives. A constant in the base, both functions in it, a^2 != b^2 + c^2 and b^2 + c^2 != 0, decided; without the constant the base is one cosine turned by a phase, which the rotation answers already, and a constant numerator over the first power is 1/S itself.

Tests: CosineAndSineOverAPowerOfAnotherIntegralTest, five rows differentiated back with the symbols pinned inside (-pi, pi).

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

master this
solved 968 978
wrong 0 0
past the budget 27 23

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 2293

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, and the rows they are short by ran past the budget there: of the 20 problems the two builds disagreed on, pocket and sample together, run again one build at a time, master answers 5 and this 17, and none that master answers is lost. This answers 12 that master does not: 8 of 4.7.7's quotients by powers of a + b cos(x) + c sin(x), each in a fifth of a second or less, where master declines them or runs past the budget; and four integrands of 3.2.1, 3.2.3 and 4.2.4.1 at twenty to twenty-four seconds, at the edge of the harness's patience.

The suite on the commit measured, 2f98b450, passed but for IntegralAnswerCacheTest.AnIntegralWithNoAnswerStillFinishesQuickly, which allows a declined integral thirty seconds and took thirty-four, with three other corpus runs on the machine; alone, that class passes in six seconds, and the integral, sin(x)/(x^3 + 1)^2, is declined in two to three seconds on either build. The allocation gate passed. On the merge with master a10be86c, a4ea9131, the 4,182 calculus and corpus tests that run pass, with 2 skipped, and the library builds for netstandard2.0; the head here merges master 9f2cc36d into that. Every row of the first table is as it says on the first merge. On the merge with master a4141483, 5caaab6d, the 4,197 that run pass, with 2 skipped, the cache class among them, and the library builds for netstandard2.0; that run took within one per cent of the same tests on #1762's merge with the same master, and no test that differs reads a cosine and a sine over another such sum.

On the merge with master bf5d1a18, 5f2af585, the head here, the 4,202 calculus and corpus tests that run pass, with 2 skipped, and the library builds for netstandard2.0.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 3 commits October 4, 2026 17:34
…hrough its derivative

(A + B cos(y) + C sin(y))/(a + b cos(y) + c sin(y))^n is alpha/S^(n-1)
+ beta S'/S^n + gamma/S^n for the base S, with alpha, beta and gamma
read off the cosine, the sine and the constant. The middle term is a
logarithm or a power of S, and with T = b sin(y) - c cos(y),
T^2 = b^2 + c^2 - (S - a)^2 gives
d/dy (T S^m) = (1 + m) S^(m+1) - a (1 + 2m) S^m + m (a^2 - b^2 - c^2) S^(m-1),
which brings each power of S down to 1/S, answered by the half-angle
tangent. Rubi's sin(x)/(a + b cos(x) + c sin(x)) was declined, and the
squares and cubes of the denominator past the budget.

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 763f7ba 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