Skip to content

A power of a homogeneous trigonometric factor is read as that power, and a cos + b sin with symbols reaches the tangent - #1483

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-cos-plus-b-sin
Sep 24, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-cos-plus-b-sin

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

sec(x)^2/(a cos(x) + b sin(x))^4 was left as written after ten minutes, where sec(x)^2/(2 cos(x) + 3 sin(x))^4 took a tenth of a second.

Both are quotients of homogeneous polynomials in the sine and cosine, which t = tan(x) turns into a rational function (Bioche's third rule), and SolveByHomogeneousTrigonometricSubstitution answers the numeric one at the top. It read each side by expanding it first. With numbers, the expanded quartic in t is (2 + 3t)^4 again as soon as the rational integrator factors it. With symbols it is a^4 + 4a^3 b t + 6a^2 b^2 t^2 + 4a b^3 t^3 + b^4 t^4, a quartic with a symbol in every coefficient that nothing factors back — so the search went on past its budget. Timing each step of the rule settled it: read in 5 ms, substituted and simplified by 99 ms, and then the expanded quartic.

A side is now read a factor at a time, with a whole power of a homogeneous factor read as that power of it: the degrees add and the rewritten factors are raised as written, so the substitution hands on (1 + t^2)^2/(a + b t)^4, which takes half a second. A side whose factors are not homogeneous one by one is still read whole, as before.

Measured

before after
sec(x)^2/(a cos(x) + b sin(x))^4 > 10 min, unevaluated 88 ms
Rubi 4.7.2 trig^m (a trig + b trig)^n, all 290 problems 199 215, no row lost, 27 timeouts → 20
Rubi family 4 330/422 332/422
families 1, 5, 6, 7 and the 1774-problem suite — no row lost; the suite stays at 1719, 0 wrong
unit suite 12,677 12,682 (five cases added), 0 failed, run to completion
allocation gate — PASSED on all 19 gated benchmarks

The sixteen rows are all trig^m/(a cos + b sin)^n with symbolic a and b, sin, cos, sec and csc above — two of them the a cos + i a sin kind. The existing tests all had numeric coefficients, which is why this survived them; the new ones pin a = 1.7, b = 0.6 after integrating symbolically.

The family 1/5/6/7 counts are not quoted as gains here: their baselines predate the harness change that checks complex-valued integrands as complex numbers, so a raised count would mix the two. "No row lost" holds either way, since that change only ever adds answered rows.

Part of #718.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

…and a cos + b sin with symbols reaches the tangent

`sec(x)^2/(a cos(x) + b sin(x))^4` was left as written after ten minutes, where
`sec(x)^2/(2 cos(x) + 3 sin(x))^4` took a tenth of a second. Both are quotients of
homogeneous polynomials in the sine and cosine, which `t = tan(x)` turns into a rational
function -- Bioche's third rule -- and the rule read each side by expanding it first. With
numbers the expanded quartic in `t` is `(2 + 3t)^4` again as soon as the rational integrator
factors it; with symbols it is `a^4 + 4 a^3 b t + 6 a^2 b^2 t^2 + 4 a b^3 t^3 + b^4 t^4`, a
quartic with a symbol in every coefficient that nothing factors back.

A side is now read a factor at a time, and a whole power of a homogeneous factor as that power
of it: the degrees add and the rewritten factors are raised as written, so the substitution
hands on `(1 + t^2)^2/(a + b t)^4`, which takes half a second. A side whose factors are not
homogeneous one by one is still read whole, as before.

Rubi's 4.7.2, `trig^m (a trig + b trig)^n`, all 290 problems: 199 to 215 with no row lost
and 27 timeouts to 20. Family 4 330 to 332 of 422; no row lost in families 1, 4, 5, 6 or 7 or
the 1774-problem suite, which stays at 1719.

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 575573a 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