A root of a quadratic in the tangent is rotated until the quadratic has no linear term - #1475
Merged
Merged
Conversation
…as no linear term `1/sqrt(1 + 2 tan(x) + 3 tan(x)^2)` was left as written, though `1/((1 + t^2) sqrt(A + C t^2))` -- what the tangent substitution leaves of it once the linear term is gone -- was already answered. Under `x = y + arctan(m)` the tangent becomes `(tan(y) + m)/(1 - m tan(y))`, the Möbius map that preserves `1 + tan^2`, and the quadratic's linear coefficient becomes `b(1 - m^2) + 2(c - a)m`: zero for a root of `b m^2 + 2(a - c)m - b`, whose discriminant `4((a - c)^2 + b^2)` is never negative, so the rotation is always real. The two roots are the quadratic form's perpendicular directions and either will do. The radicand is assembled -- `A = a + bm + cm^2`, `C = am^2 - bm + c` -- and not substituted into: writing the quotient inside the root leaves a nesting that nothing downstream reduces, which is how the first version of this rule turned a decline into a ninety-second search. The modulus that `sqrt(N/(1 - mS)^2)` leaves comes out in front as `sgn(1 - m tan(y))`, constant between its zeros. A numeric rotation only. With symbolic coefficients `m` is a nested surd, the rotated quadratic is written in it, and what the rational integrator is handed is a quotient over that field: two minutes and no answer, where the integrand is declined in under a second unrotated. That bound is on the work rather than on the mathematics, and a test pins that the symbolic shape is still declined quickly. Family 4 of the Rubi suite: 290/422 either way, 0 wrong -- its rows of this family are symbolic; family 6 377/417 and the 1774-problem suite 1707 unchanged. Suite 12655 passed; allocation gate passed on all 19 gated benchmarks. Each new row differentiates back at five points. Part of #718. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
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/sqrt(1 + 2 tan(x) + 3 tan(x)^2)was left as written — though1/((1 + t^2) sqrt(A + C t^2)), which is what the tangent substitution leaves of it once the linear term is gone, was already answered.Under
x = y + arctan(m)the tangent becomes(tan(y) + m)/(1 - m tan(y)): the Möbius map that preserves1 + tan^2, the factor the tangent substitution'sdxbrings. The quadratic's linear coefficient becomesb(1 - m^2) + 2(c - a)m, zero for a root ofb m^2 + 2(a - c)m - b, whose discriminant4((a - c)^2 + b^2)is never negative — the two roots are the quadratic form's perpendicular directions, and either will do.Two things the measurements decided:
A = a + bm + cm^2,C = am^2 - bm + c. Writing the Möbius quotient inside the root leaves a nesting that neitherSimplifynor the chain reduces, so the substitution never sees the rotated quadratic: the first version of this rule turned a 787 ms decline into a 90 s search. The modulus thatsqrt(N/(1 - mS)^2)leaves comes out in front assgn(1 - m tan(y)), constant between its zeros as every such sign in these rules is.a, b, cthe rotationmis a nested surd, the rotated quadratic is written in it, and the rational integrator is handed a quotient over that field — two minutes and no answer, against a 0.8 s decline unrotated. The bound is on the work, not on the mathematics; a test pins that the symbolic shape is still declined quickly.Measured (final build):
int dx/sqrt(1 + 2 tan x + 3 tan^2 x)and its kin.bench.sh: PASSED on all 19 gated benchmarks.tan(x)^2/(2 + tan(x) + tan(x)^2)^(3/2).The symbolic case wants a rational integrator that stays in a quadratic field rather than expanding into it; that is the next piece of this, and it is not in here.
Part of #718.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura