Skip to content

A root of a square in a trigonometric function is its modulus - #1765

Merged
Rafael-SOWNet merged 3 commits into
masterfrom
a-root-of-a-square-in-a-trigonometric-function-is-its-modulus
Oct 5, 2026
Merged

Rafael-SOWNet merged 3 commits into
masterfrom
a-root-of-a-square-in-a-trigonometric-function-is-its-modulus

Conversation

@Rafael-SOWNet

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

Copy link
Copy Markdown
Member

Part of #718.

(a + b sin(x)) sqrt(b^2 + 2 a b sin(x) + a^2 sin(x)^2) was declined or past the budget, with the rest of Rubi's 4.7.7 half-odd powers of a perfect square in a sine, a tangent or a secant. 2.5.0 declined them:

integrand 2.5.0 master a4141483 this
(a + b sin(x)) sqrt(b^2 + 2 a b sin(x) + a^2 sin(x)^2) declined after 5.5 s declined after 14 s sgn(sin(x) + b/a) sqrt(a^2) times the integral of the square, in 0.6 s
(a + b tan(x))/sqrt(b^2 + 2 a b tan(x) + a^2 tan(x)^2) declined declined after 2.8 s in 1.6 s
(a + b sec(x)) (b^2 + 2 a b sec(x) + a^2 sec(x)^2)^(3/2) declined after 8.9 s declined in 0.3 s
(a + b sin(g + f x))/(b^2 + 2 a b sin(g + f x) + a^2 sin(g + f x)^2)^(3/2) declined past 20 s in 3.8 s

Each answer is differentiated back with a = 1.3, b = 0.7, f = 1.1, g = 0.4 and compared at x = -2.3, -1.1, -0.3, 0.4, 1.1, 2.3; the times include that.

What changes. b^2 + 2 a b f + a^2 f^2 is a^2 (f + b/a)^2, so a half-odd power of it is that power of sqrt(a^2) |f + b/a|, and the sign of f + b/a, constant between its zeros, goes in front of the integral -- what SolveByTakingARootOfAPerfectSquare does for a square in x, with one trigonometric function for the variable. The rest is rational in the function. At the top only, where each such root is a factor of the integrand; the leading coefficient a positive number or one of known sign for a real parameter, whose condition, a^2 > 0, travels with the answer as that rule's does.

Tests: RootOfASquareInATrigonometricFunctionIntegralTest, four rows differentiated back with the symbols pinned, on both sides of the zeros of f + b/a and of zero; none is answered on master.

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 690 702
wrong 0 0
past the budget 21 17

Measured then on the Rubi corpus against master 287c69a7:

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

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 22 problems the two builds disagreed on, pocket and sample together, run again one build at a time, master answers 7 and this 14. This answers 12 that master does not, 4.7.7's half-odd powers of b^2 + 2 a b f + a^2 f^2 for f the sine, the tangent and the secant, all but three in under a second and those in two and a half to five, where master declines them or runs past the budget. Master answers five that ran past the harness's patience here, logarithms of 3.2.1 and 3.2.3 that it answers at twenty-one to twenty-five seconds, at the edge of that patience. Run again, twice on each build, master answered two of the five in each run, at twenty-two and twenty-three seconds, and this ran past the patience on all five both times. Timed one at a time with a minute's budget, the first is answered on both builds in seven to eight and a half seconds, and the next two run past the minute on both: they sit at the edge of the harness's patience on a loaded machine, and the new rule, which reads trigonometric functions, runs once at the top of the question.

The suite on the commit measured, 4517be5b, passed, and so did the allocation gate. On the merge with master a4141483, 1b17303f, the 4,196 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.

The head here, b98ba491, merges master 763f7bae into that; its checks are this pull request's.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 2 commits October 4, 2026 17:41
b^2 + 2 a b f + a^2 f^2 is a^2 (f + b/a)^2, so a half-odd power of it is
that power of sqrt(a^2) |f + b/a|, written with the sign of f + b/a in
front of the integral, as the root of a perfect square in x already is.
At the top, for one trigonometric function f and where each such root is
a factor of the integrand. Rubi's (a + b sin(x)) sqrt(b^2 + 2 a b sin(x)
+ a^2 sin(x)^2) and the rest of its 4.7.7 with a tangent or a secant
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
@Rafael-SOWNet Rafael-SOWNet added this to the 2.6.0 milestone Oct 4, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit a883374 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