Skip to content

An odd power of a cos + b sin is rotated into one cosine - #1484

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
harmonic-phase
Sep 24, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
harmonic-phase

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

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.

Harmonic addition. 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 (the tests pin a = -1.7 as well as 1.7 for that reason); a bare u is y less a constant. R is 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:

  • Only a sum below the bar. The rotation writes such sums above it itself (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_3 until the budget ran out.
  • Nothing else below the bar holds x, so that one rotation leaves a power of one cosine.
  • Only sines and cosines. 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)), 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

before after
1/(a cos(x) + b sin(x))^3 declined after 3.6 s 0.3 s
cos(x)^3/(a cos(x) + b sin(x))^2 declined after 2 s 0.9 s
Rubi 4.7.2 trig^m (a trig + b trig)^n, all 290 problems 215 (after #1483) 237, no row lost, 20 timeouts → 16
Rubi families 1, 4, 5, 6, 7 and the 1774-problem suite — unchanged, row for row — their samples hold few 4.7.2 rows
unit suite 12,682 12,689 (seven cases added), 0 failed, run to completion
allocation gate — PASSED on all 19 gated benchmarks

With #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

`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
@Rafael-SOWNet
Rafael-SOWNet merged commit 7107b37 into master Sep 24, 2026
31 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