Skip to content

A power of a cosine and a sine plus their amplitude is integrated - #1761

Merged
Rafael-SOWNet merged 3 commits into
masterfrom
a-power-of-a-cosine-and-a-sine-plus-their-amplitude
Oct 4, 2026
Merged

Rafael-SOWNet merged 3 commits into
masterfrom
a-power-of-a-cosine-and-a-sine-plus-their-amplitude

Conversation

@Rafael-SOWNet

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

Copy link
Copy Markdown
Member

Part of #718.

sqrt(5 + 4 cos(x) + 3 sin(x)) was declined, with the rest of Rubi's 4.7.7 powers of a + b cos(y) + c sin(y) with a^2 = b^2 + c^2, some of the reciprocal powers after searches past the budget. 2.5.0 declined them too:

integrand 2.5.0 master a10be86c this
sqrt(5 + 4 cos(x) + 3 sin(x)) declined declined 2 (4 sin(x) - 3 cos(x))/sqrt(5 + 4 cos(x) + 3 sin(x)), in 0.8 s
(5 + 4 cos(x) + 3 sin(x))^(5/2) declined declined in 0.05 s
1/sqrt(5 + 4 cos(x) + 3 sin(x)) declined declined after 2.8 s a logarithm, in 0.09 s
1/(5 + 4 cos(x) + 3 sin(x))^(3/2) declined declined after 2.7 s in 0.2 s
(-5 + 4 cos(x) + 3 sin(x))^(3/2) declined declined in 0.04 s
1/(b cos(g + f x) + c sin(g + f x) + sqrt(b^2 + c^2))^(5/2) declined past 20 s in 0.3 s
(b cos(g + f x) + c sin(g + f x) - sqrt(b^2 + c^2))^(3/2) declined declined in 0.07 s
1/(b cos(g + f x) + c sin(g + f x) - sqrt(b^2 + c^2))^3 declined past 20 s in 0.1 s

Each answer is differentiated back with b = 0.9, c = 0.7, g = 0.4, f = 1.3 and compared at x = -2, -0.7, 0.4, 1.5, 2.6, as complex numbers; the times include that.

What changes. b cos(y) + c sin(y) is R cos(y - phi) for R = sqrt(b^2 + c^2), so with a^2 = b^2 + c^2 the base is a (1 ± cos(y - phi)), a square of the half angle, as a + a sin(y) is -- and the rule for that two-term case, SolveAHalfPowerOfOnePlusASine, has the identity this one uses. With S the base and T = b sin(y) - c cos(y), T' = S - a, S' = -T and T^2 = S (2a - S), the last being a^2 = b^2 + c^2, so that d/dy (T S^(n-1)) = n S^n - a (2n - 1) S^(n-1). That steps a half-odd power down to 1/2, where the integral is 2T/sqrt(S), or up to -1/2 or -1, where it is (2/sqrt(2a)) atanh(T/(sqrt(2a) sqrt(S))) and T/(a S); each base is checked by differentiating it with the three identities alone. The answer needs no phi. For a real a of either sign, an antiderivative on every interval between the zeros of S: the derivations use only S^(3/2) = S sqrt(S) and (sqrt(2a) sqrt(S))^2 = 2a S, and one less the square of the hyperbolic arctangent's argument is S/(2a), not negative. Half-odd powers either way and negative whole ones, up to eight; a^2 = b^2 + c^2 decided, not assumed.

Tests: CosineAndSinePlusTheirAmplitudeIntegralTest, eight rows differentiated back with the symbols pinned and compared as complex numbers on both sides of zero; with a negative the integrand is imaginary on the whole line. None is answered on master.

Measured first on the 293 problems of Rubi's 4.7.7 with a cosine and a sine of one argument and the 290 of 4.7.2, at the corpus's 5-second budget, against master 287c69a7, the branch's base:

master this
solved 504 531
wrong 0 0
past the budget 22 12

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 2296

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 39 problems the two builds disagreed on, pocket and sample together, run again one build at a time, master answers 7 and this 34. This answers 28 that master does not: 27 of 4.7.7's powers of a + b cos(d + e x) + c sin(d + e x) with a^2 = b^2 + c^2, each in under a quarter of a second, where master declines them, some after eighteen seconds or past the budget; and a 6.6.1 integrand at twenty-two seconds, at the edge of the harness's patience. Master answers one that ran past the patience here, (A + B cos(x) + C sin(x))/(a + b cos(x) + c sin(x))^2, at twenty-three seconds. Run again, twice on each build, both builds ran past it on both. One more, (-5 + 4 cos(d + e x) + 3 sin(d + e x))^(7/2), is answered here and counted unverified, its integrand being imaginary on the whole line; differentiated back at five points as complex numbers it is right.

The suite on the commit measured, 2808ab49, passed, and so did the allocation gate. On the merge with master a10be86c, f45d54b9, the 4,185 calculus and corpus tests that run pass, with 2 skipped, and the library builds for netstandard2.0. Every row of the first table is as it says on the merge. On the merge with master 9f2cc36d, d6e1afd5, the head here, the 4,192 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 2 commits October 4, 2026 17:10
b cos(y) + c sin(y) is R cos(y - phi) for R = sqrt(b^2 + c^2), so with
a^2 = b^2 + c^2 the base a + b cos(y) + c sin(y) is a square of the
half angle. With T = b sin(y) - c cos(y), T' = S - a, S' = -T and
T^2 = S (2a - S), and d/dy (T S^(n-1)) = n S^n - a (2n - 1) S^(n-1)
steps a half-odd power down to 1/2, where the integral is 2T/sqrt(S),
or up to -1/2 or -1, where it is (2/sqrt(2a)) atanh(T/(sqrt(2a) sqrt(S)))
and T/(a S). No phi appears. sqrt(5 + 4 cos(x) + 3 sin(x)) and the rest
of Rubi's 4.7.7 with a^2 = b^2 + c^2 were declined or 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
…-and-a-sine-plus-their-amplitude

# Conflicts:
#	Sources/AngouriMath/Functions/Continuous/Integration/Integration.Definition.cs
@Rafael-SOWNet Rafael-SOWNet added this to the 2.6.0 milestone Oct 4, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit a414148 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