Skip to content

acsch(c x) and asech(c x) are integrated with a symbolic c, and |c| differentiates to 0 in x - #1451

Merged
Rafael-SOWNet merged 2 commits into
masterfrom
whole-powers-of-products
Sep 21, 2026
Merged

Rafael-SOWNet merged 2 commits into
masterfrom
whole-powers-of-products

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Rubi's 7.5.1 and 7.6.1 — u (a + b asech(c x))^n and u (a + b acsch(c x))^n — stood at 2/15 and 1/15, and the reason was one symptom with four causes: x acsch(2 x) was answered and x acsch(c x) declined (a numeric coefficient hiding a symbolic defect, again). The parser spells acsch(c x) as ln(1/(c x) + sqrt(1/(c x)^2 + 1)), and:

  1. (c x)^2 was read as a power of something that is not a polynomial, where (2 x)^2 had been folded to 4 x^2. SolveByDistributingWholePowersOfProducts writes a whole power of a product with a symbolic constant beside the variable as the product of the powers and asks the question again. Symbolic only: for a numeric constant the rules fold it already, and rewriting for it re-asked every sub-integrand with a (2 u)^3 in it — Welz's 67 went from 4 s to 34 s in the first version.
  2. The root of (1 + c^2 x^2)/(c^2 x^2) was not written apart because c^2 is not a number. SolveByWritingAPowerOfAQuotientApart now takes a parameter's even power for positive (IsPositiveForARealParameter) and the answer says so: provided c^2 > 0, which holds exactly for a real non-zero c. (c^2)^(-1/2) is written 1/|c|, one atom wherever it stands.
  3. The step by parts differentiated |c| to derivative(|c|, x), since the modulus rule asks whether its argument is real before it asks whether the argument mentions the variable — and every rule downstream then read a function of x. The modulus, the sign, the floor, the ceiling, the rounding, a limit, a sum, a product, an applied function and any node with no rule of its own differentiate to 0 where they do not mention the variable, with no condition; a node with a rule of its own keeps it (d/dy piecewise(x provided a, 1/x) still says where 1/x exists). floor(c) + x no longer carries provided not c in ZZ. A first version made every constant 0 and broke that piecewise pin and d/dx 21^NaN, which is NaN.
  4. q^(-1/2) above and sqrt(q) below were two indeterminates to the cancellation, so the remainder by parts was never read as the rational function of x and one root that it is. A negative fractional power goes below the bar before the cancellation — only where the same radicand also stands under a positive one, since moving every reciprocal root multiplied the other quotients through and fed a search (x^5 atanh(x sqrt(p)/sqrt(d + p x^2)) went from a decline in 4 s to none).

And SolveAsPolynomialTerm gathers the constant factors from every position among the factors once the two-operand reading has declined: x^2 (a + b L) splits into a x^2 and x^2 * b * L, whose b sat inside the left product and was integrated around (five minutes where the row without a + b took one second). Gathering first sent 1/((a + b x)^2 (c + d x)^(3/2)) down another path and its answer grew from 700 characters to 24,000, which SymbolicFactorsPartialFractionsTest caught.

corpus before after
Rubi 1774 1706/1774, 0 wrong, 0 timeout 1706/1774, 0 wrong, 0 timeout — unchanged
family 7 (15 per file, 5 s) 162/270, 0 wrong, 46 timeouts 187/270, 0 wrong, 54 timeouts
7.5.1 / 7.5.2 / 7.6.1 / 7.6.2 2 / 3 / 1 / 3 of 15 4 / 10 / 7 / 13 of 15

The rows that moved from unevaluated to timeout are acsch rows that now solve in 5–30 s, over the harness's 5 s budget (x^2 (a + b acsch(c x)) is 4.7 s, (a + b acsch(c x))/x^3 26 s); x^5 atanh(x sqrt(p)/sqrt(d + p x^2)) is the one row whose decline became a search — its remainder, once read, is x^6/sqrt(d + p x^2) up to a constant, which is the cost of the capability rather than of the step.

InverseHyperbolicSecantIntegralTest (differentiates back at five points with c = 3/2, and pins the c^2 > 0 condition), eleven derivative rows in ModulusPhaseTest; BREAKING-CHANGES.md. Full suite 12358 passed; the allocation gate passes on all 19 gated benchmarks.

Part of #718.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 2 commits September 21, 2026 14:55
…ifferentiates to 0 in x

x acsch(2 x) was answered and x acsch(c x) declined, for four reasons: (c x)^2 was read as a power
of something that is not a polynomial where (2 x)^2 had been folded -- a whole power of a product
with a symbolic constant beside the variable is written as the product of the powers, as a rule
of its own; the root of (1 + c^2 x^2)/(c^2 x^2) was not written apart because c^2 is not a number
-- a parameter's even power is taken for positive, the answer says so with provided c^2 > 0, and
(c^2)^(-1/2) is written 1/|c|; the step by parts differentiated |c| to derivative(|c|, x) -- the
modulus, the sign, the floor and their kin, and any node with no rule of its own, differentiate
to 0 where they do not mention the variable; and q^(-1/2) above and sqrt(q) below were two atoms
to the cancellation -- a negative fractional power goes below the bar where the same radicand
also stands under a positive one. SolveAsPolynomialTerm gathers constants from any position
among the factors once the two-operand reading has declined. Rubi's family 7: 162 -> 187 of 270,
0 wrong; the 1774 unchanged at 1706, 0 wrong, 0 timeout.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet
Rafael-SOWNet merged commit 27b98dd into master Sep 21, 2026
31 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the whole-powers-of-products branch September 21, 2026 15:58
Rafael-SOWNet added a commit that referenced this pull request Sep 21, 2026
…onstant in the derivative (#1455)

Two findings of the workspace harnesses against 04a5dd4, both from work merged
today:

- crashcheck: `"x subset 2".ToEntity().Solve("x")` threw InvalidCastException.
  The solver answers `{ x : x subset 2 }`; the predicate is NaN, since 2 is not a
  set, and a NaN predicate made the whole set-builder NaN, which Solve then cast
  to a set. A predicate that is NaN holds nowhere, so the set-builder is the empty
  set -- which is what the solver already answered for `1/0 = x`, and what
  `{ x : 1/0 = x }` now evaluates to as well (was NaN in 2.5.0; recorded).

- docsamples: `"{ 1, 2 } + sin(x)".Differentiate("x")` printed `cos(x)` where the
  wiki's Differentiation page says `{ cos(x) }`. #1451 made the base derivative
  of a node that does not mention the variable zero; a set is not a constant in
  the variable whatever it mentions, so a set keeps the derivative node, which
  reaches the elements.

Part of #1409.


Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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