Skip to content

Four nested roots with a closed form are integrated - #1787

Merged
Rafael-SOWNet merged 2 commits into
masterfrom
a-nested-root-is-integrated-in-the-quotient-it-is-the-derivative-of
Oct 5, 2026
Merged

Rafael-SOWNet merged 2 commits into
masterfrom
a-nested-root-is-integrated-in-the-quotient-it-is-the-derivative-of

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #718.

Rubi's 1.3.3 gives four nested roots a closed form, and all four were declined -- sqrt(1 + sqrt(1 - x^2)), Welz's sqrt(x^2 + sqrt(1 + x^4))/sqrt(1 + x^4) and Timofeev's 1/((1 + x^4) sqrt(-x^2 + sqrt(1 + x^4))) among them:

integrand 2.5.0 master 2b86349c this
sqrt(1 + sqrt(1 - x^2)) declined declined 102 characters
sqrt(x^2 + sqrt(1 + x^4))/sqrt(1 + x^4) declined declined 161 characters
1/((1 + x^4) sqrt(-x^2 + sqrt(1 + x^4))) declined declined 70 characters
sqrt(a x^2 + b x sqrt(-a/b^2 + a^2 x^2/b^2))/(x sqrt(-a/b^2 + a^2 x^2/b^2)) declined declined 528 characters

Each answer is differentiated back and compared with the integrand at six points.

What changes. SolveANestedRootByItsClosedForm, asked after SolveByTakingARootOfAPerfectSquare, reads the integrand's factors from both sides of the bar as powers and answers four shapes:

  • sqrt(a + b sqrt(c + d x^2)) with a^2 = b^2 c, which is 2 b^2 d x^3/(3 S^(3/2)) + 2 a x/sqrt(S) for the root S;
  • sqrt(c x^2 + d sqrt(a + b x^4))/sqrt(a + b x^4) with c^2 = b d^2, and 1/((a + b x^n) sqrt(c x^2 + d (a + b x^n)^(2/n))): each is the derivative of w = x/sqrt(S) over 1 - 2 c w^2 or 1 - c w^2, since S' = 2 c x S/(d R) for the inner root R;
  • sqrt(a x^2 + b x sqrt(c + d x^2))/(x sqrt(c + d x^2)) with a^2 = b^2 d and b^2 c + a = 0, which is sqrt(2) b/a times 1/sqrt(1 + t^2/a) in t = a x + b sqrt(c + d x^2).

The integral in w or t is asked of the integrator with its coefficient named, each condition is decided as a value, and the answer is differentiated back at sampled points before it is returned.

Tests: NestedRootClosedFormIntegralTest, seven rows over the four shapes, with symbols and without, differentiated back.

Measured first on 1,232 problems with two roots or more, nested or side by side, 228 of them Rubi's 1.3.2, at the corpus's 5-second budget, against master 287c69a7, the branch's base:

master this
solved 1040 1054
wrong 0 0
past the budget 28 28

Measured then on the Rubi corpus against master 287c69a7:

master this
family 0, independent suites (1814) 1772 1775
family 1, 40 a file (1381) 1308 1307
families 2 to 8, sampled (2410) 2301 2297

The harness counts no answer wrong in either. The 22 problems the two builds disagreed on, pocket and sample together, run again one build at a time: this answers 14 that master does not -- 1.3.2:651-654, 1222-1223, 1326-1328 and 1338-1339, Welz's 49 and 50 and Timofeev's 447 -- and master none that this does not. The other eight take over 12 seconds on either build or run past the budget on both, and the load decides whether they are answered.

The suite on the commit measured, 03360aa6, was cut short in the chain: its test host was stopped at 7.8 GB on a loaded machine. Run again under a 4 GB heap it passes, 14,829 tests. The allocation gate failed in the chain at EvalPolynomialFresh, 65 times the baseline's time and 10.6% more allocation on that loaded machine, and run again it passes, at the baseline's allocation exactly. The head here, 3a10335a, merges master 2b86349c; the calculus and corpus tests pass on it, 4,301 tests, and the library builds for netstandard2.0.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 2 commits October 5, 2026 05:01
Rubi's 1.3.3 gives four nested roots a closed form, and they were declined:
sqrt(a + b sqrt(c + d x^2)) with a^2 = b^2 c, which is
2 b^2 d x^3/(3 S^(3/2)) + 2 a x/sqrt(S) for the root S;
sqrt(c x^2 + d sqrt(a + b x^4))/sqrt(a + b x^4) with c^2 = b d^2, and
1/((a + b x^n) sqrt(c x^2 + d (a + b x^n)^(2/n))), each the derivative of
w = x/sqrt(S) over 1 - k w^2; and sqrt(a x^2 + b x sqrt(c + d x^2))/(x
sqrt(c + d x^2)) with a^2 = b^2 d and b^2 c + a = 0, in t = a x + b sqrt(c +
d x^2). The integral in w or t is asked of the integrator with a symbolic
coefficient named, and the answer is differentiated back before it is
returned.

Part of #718.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
…tegrated-in-the-quotient-it-is-the-derivative-of

# Conflicts:
#	Sources/AngouriMath/Functions/Continuous/Integration/Integration.Definition.cs
@Rafael-SOWNet Rafael-SOWNet added this to the 2.6.0 milestone Oct 5, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit 404a98a into master Oct 5, 2026
34 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the a-nested-root-is-integrated-in-the-quotient-it-is-the-derivative-of branch October 29, 2026 00:43
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