Skip to content

Half-odd powers of a ± a sec and a ± a csc by the half-angle tangent - #1584

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-half-odd-power-of-one-plus-a-secant
Sep 29, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-half-odd-power-of-one-plus-a-secant

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #718: half-odd powers of a ± a sec(y) and a ± a csc(y), Rubi's (a + b sec)^m (d sec)^n files with a^2 = b^2, by the half-angle tangent.

About a thousand of Rubi's problems in 4.5.1 to 4.5.4 and 4.6.1 have a half-odd power of a ± a sec or a ± a csc. Master answered 165 of the 970 the harness can state, seven of them wrongly, and sqrt(1 + sec(x)) was declined. The half angle at which a + a cos(y) is a square does not reach them, since 1 + sec(y) is that square over cos(y) and a root of the cosine is left below the bar.

The substitution. Under t = tan(y/2):

  • 1 + sec(y) = 2/(1 - t^2);
  • 1 - sec(y) = -2 t^2/(1 - t^2);
  • sec(y) = (1 + t^2)/(1 - t^2), and everything else rational in the sine and cosine is rational in t.

So the integrand is a rational function of t beside one root, of 1 - t^2 or of 1 + t^2, and the rules for a rational function beside a root of a quadratic answer it. A half-odd power of the secant beside a whole power of 1 ± sec leaves roots of both quadratics. That is elliptic, and it is declined before anything is asked. The powers of the two quadratics and of t are gathered to one each before the check and before the chain, so that they cancel: left as written, sec(y) beside dy reached the rules in t as (1 + t^2)^0, which none reads.

Where it holds. a (1 + sec(y)) is not negative with t inside (-1, 1) for a positive a, and outside it for a negative one. Either way (2a/(1 - t^2))^p is (2a)^p (1 - t^2)^(-p) for the principal powers, and the same holds for a power of the secant beside it. For 1 - sec(y) the square t^2 comes out of the root as |t|, and sgn(tan(y/2)), constant between its zeros, goes in front. Outside (-1, 1) a root whose radicand is negative is imaginary. One alone leaves the integrand complex there, where the answer has nothing to be wrong about. Two can make it real again: (1 + sec(x))^(5/2) sqrt(cos(x)) is real where the cosine is negative, and there each root written apart may have turned its sign where the other did not. So an answer through two roots says provided cos(y) >= 0, which is where it was checked. LinearRadicalSubstitutionIntegralTest.TheSearchsEvenRootSaysWhereItHolds pins exactly that for this integrand, and it failed here until the condition went in. The cosecant's the same way through the complement, csc(y) = sec(pi/2 - y), with t = tan(pi/4 - y/2). Scoped to the question asked or one below it, since it lands on the chain in t.

Input Was (2.5.0) Now
sqrt(1 + sec(x)) integral(...) an arctangent in tan(x/2)
sec(x)/sqrt(a + a*sec(x)) integral(...) 2 arcsin(tan(x/2))/sqrt(2a)
1/(sec(x)^(3/2)*sqrt(1 + sec(x))) integral(...) an antiderivative through a root of 1 + tan(x/2)^2
sqrt(a - a*sec(x)) integral(...) a logarithm in tan(x/2), times sgn(tan(x/2))
sqrt(1 + csc(x)) integral(...) an arctangent in tan(pi/4 - x/2)

OnePlusASecantHalfPowerIntegralTest differentiates fifteen integrands back with the symbols pinned, at points where each is real.

Measured with work/intbench against master at a8a2b7e7, the commit this is cut from, 3 s a problem, on a build with the other five branches of this batch merged beside it. Every moved problem was then re-run on this branch alone:

  • Rubi's rows with a half-odd power of a ± a sec or a ± a csc (970 problems in 4.5.x and 4.6.x): 165 → 937 solved, none lost, 0 wrong against master's 7. This branch alone makes 769 of the 772 gains: 4.5.1.2 126, 4.5.1.4 37, 4.5.2.1 111, 4.5.2.3 98, 4.5.3.1 124, 4.5.4.2 265, 4.6.1.2 8. The other three also need the rule for a linear over a quadratic beside a root (A linear over a quadratic beside the root of another, in closed form #1583), since a c + d sec below the bar becomes a quadratic in t. Timeouts fall from 173 to 13, and the rows take 332 s instead of 1514 s.
  • Master's seven wrong answers here are answered correctly. They are sqrt(cos(c + d x)) beside a half-odd power of a + a sec(c + d x), with or without A + B sec. Where the cosine is negative, both roots are imaginary and the integrand is real, and master's answer is not an antiderivative there. Through this rule they are answered with provided cos(c + d x) >= 0. Master's route for them, and why its answer is negated there, is A root of the cosine beside a half-odd power of a + a sec is integrated wrongly where the cosine is negative #1581; this rule answers them before that route is asked.
  • Twelve rows with (c + d sec)^2 or ^3 below the bar, which master declined in 0.1 to 0.4 s, now run past the budget. Under t they are a repeated quadratic beside the root, which nothing reduces yet. Both results are no answer.
  • The families sample (912 problems) and family 0 (1814): the merged build moved 41 problems, and re-run on this branch alone, 12 are its gains, in 4.5.1.2, 4.5.1.4, 4.5.2.1, 4.5.2.3, 4.5.3.1, 4.5.4.2 and 4.6.1.2. None of the moves is a loss of this branch's.

The unit tests pass on the merged build (net10.0, 13,514), every target builds, and the allocation gate passes.

🤖 Generated with Claude Code

Rubi's (a + b sec)^m (d sec)^n files with a^2 = b^2 have about a thousand
problems with a half-odd m, and sqrt(1 + sec(x)) was declined with the rest:
the half angle at which a + a cos(y) is a square leaves a root of the cosine
below the bar here, since 1 + sec(y) is that square over cos(y). Under
t = tan(y/2), 1 + sec(y) is 2/(1 - t^2), 1 - sec(y) is -2 t^2/(1 - t^2) and
sec(y) is (1 + t^2)/(1 - t^2), so beside powers of the secant and anything
rational in the sine and cosine the whole is a rational function of t
beside one root, of 1 - t^2 or of 1 + t^2; both at once is elliptic and
declined before the chain is asked. The powers of the two quadratics and of
t are gathered to one each, so that they cancel: left as written, sec(y)
beside dy reached the rules in t as (1 + t^2)^0. The identities hold where
the integrand is real, for either sign of a; the root of 1 - sec(y) carries
sgn(tan(y/2)), constant between its zeros. The cosecant's the same way
through the complement, csc(y) = sec(pi/2 - y).

Measured with work/intbench against a8a2b7e, 3 s a problem, on a build with
the rest of its batch: Rubi's 970 rows with a half-odd power of a +- a sec
or a +- a csc, 165 -> 937 solved, 769 of the 772 gains by this alone, none
lost, and 0 wrong against master's 7, in 332 s instead of 1514 s. Twelve
declines with (c + d sec)^2 or ^3 below the bar now run past the budget.
Over the families sample (912 problems) and family 0 (1814), 12 more gained
by this alone, none lost.

Part of #718.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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