An odd power of a cos + b sin is rotated into one cosine - #1484
Merged
Merged
Conversation
`1/(a cos(x) + b sin(x))^3` was left as written. The tangent turns a quotient of homogeneous polynomials in the sine and cosine into a rational function only when the degrees differ by an even number; by an odd number it leaves a root of `1 + t^2`, and every row of that kind was declined after the substitution search had spent its budget. `a cos(y) + b sin(y)` is `R cos(u)` for `R = sqrt(a^2 + b^2)` and a shifted argument `u`, so the quotient becomes one over a power of one cosine, with `cos(y)` and `sin(y)` above it written as `(a cos(u) - b sin(u))/R` and `(b cos(u) + a sin(u))/R` -- shapes the rules for powers of the sine and cosine answer in a fraction of a second. The way back goes through `cos(u) = (a cos(y) + b sin(y))/R` and `sin(u) = (a sin(y) - b cos(y))/R` rather than through the phase, whose quadrant would depend on the signs of `a` and `b`; a bare `u` is `y` less a constant. `R` is integrated as a symbol and written out in the answer, since a root of a symbolic sum in the integrand sends it down the rules for radicals. Three restrictions, each found by the measurement: the sum is rotated only below the bar, because the rotation writes such sums above it itself and a rule that rotated any sum it found rotated its own output again; nothing else below the bar may hold `x`; and only sines and cosines, since a secant, cosecant, tangent or cotangent puts a cosine or sine below the bar that the rotation turns into one more sum -- `csc(x)^2/(a cos(x) + b sin(x))`, declined in a quarter of a second, spent two minutes that way. Those rows want partial fractions over the two linear factors instead. Rubi's 4.7.2, all 290 problems: 215 to 237, no row lost, 20 timeouts to 16. Families 1, 4, 5, 6 and 7 and the 1774-problem suite unchanged, row for row. Part of #718. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
This was referenced Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1/(a cos(x) + b sin(x))^3was left as written. The tangent turns a quotient of homogeneous polynomials in the sine and cosine into a rational function only when the degrees differ by an even number; by an odd number it leaves a root of1 + t^2, and every row of that kind was declined after the substitution search had spent its budget.Harmonic addition.
a cos(y) + b sin(y)isR cos(u)forR = sqrt(a^2 + b^2)and a shifted argumentu, so the quotient becomes one over a power of one cosine, withcos(y)andsin(y)above it written as(a cos(u) - b sin(u))/Rand(b cos(u) + a sin(u))/R— shapes the rules for powers of the sine and cosine answer in a fraction of a second. The way back goes throughcos(u) = (a cos(y) + b sin(y))/Randsin(u) = (a sin(y) - b cos(y))/Rrather than through the phase, whose quadrant would depend on the signs ofaandb(the tests pina = -1.7as well as1.7for that reason); a bareuisyless a constant.Ris integrated as a symbol and written out only in the answer, because a root of a symbolic sum in the integrand sent it down the rules for radicals.Three restrictions, each found by measuring rather than reasoning:
cos(y)becomes(a cos(u) - b sin(u))/R), and the first version, which rotated any sum it found, rotated its own output again —u_1,u_2,u_3until the budget ran out.x, so that one rotation leaves a power of one cosine.csc(x)^2/(a cos(x) + b sin(x)), which master declines in a quarter of a second, spent two minutes that way. Those rows want partial fractions over the two linear factors — a different rule.Measured
1/(a cos(x) + b sin(x))^3cos(x)^3/(a cos(x) + b sin(x))^2trig^m (a trig + b trig)^n, all 290 problemsWith #1483, the 4.7.2 file goes from 199 to 237 of 290.
Part of #718.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura