Skip to content

Defer Evaluating RootSums - #1430

Merged
axkr merged 8 commits into
masterfrom
rootsum-defer-to-rubi
Jul 19, 2026
Merged

Defer Evaluating RootSums#1430
axkr merged 8 commits into
masterfrom
rootsum-defer-to-rubi

Conversation

@axkr

@axkr axkr commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Thanks for contributing.

Description

Before producing RootSum expressions in the Integrate tool chain, let the Rubi integration engine search fo simpler Integrate solutions.

axkr and others added 8 commits July 19, 2026 12:30
…ndex

SeriesCoefficient[(a+b*x)^p, {x, 0, n}] with a symbolic index n emitted an
opaque DifferenceRoot for finite binomial powers, and returned unevaluated
for fractional exponents such as Sqrt(1+x).

Add a binomialPowerSeriesCoefficient fast-path (run after the rational path
and before the holonomic/DifferenceRoot path) that emits the closed form
Piecewise({{b^n*a^(p-n)*Binomial(p,n), cond}}, 0), with cond = 0<=n<=p for a
non-negative integer p and n>=0 otherwise. Matches Mathematica/WOXI. Guarded
to symbolic index, x0==0, nonzero constant term, and non-negative/non-integer
exponents (negative integers stay on the rational path for a cleaner form).

Add testSeriesCoefficientBinomialWoxi to SeriesTest.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mine the Apache-licensed WOXI test suite for Symja calculus gaps, fix the
stragglers found, and add WOXI-derived JUnit tests throughout.

ZTransform/InverseZTransform: fix the n^k infinite recursion (guard the
ExpandAll branch, route pure powers through the (-z d/dz)^k operator),
combine polynomial results via Together, add a robust single-linear-pole
inverse handler covering every sign/scaling variant and symbolic poles,
and support UnitStep.

PadeApproximant: when the Series is flagged Puiseux but expands into
integer powers of x (e.g. Sqrt(1+x)), compute the approximant from the
Normal Taylor polynomial instead of returning unevaluated.

DifferenceDelta: canonicalize the generic forward difference (Factor for a
numeric step, Expand for a symbolic step), leaving symbolic-function
differences such as f(x+1)-f(x) untouched.

DiscreteShift: for integer shifts, combine rational summands over a common
denominator and expand top-level Plus results.

DiscreteRatio: support the {k, order, step} spec and reduce the ratio via
Together(FunctionExpand(...)).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
RationalIntegration.integrate() ran before the Rubi rules in the Integrate
cascade. That is form-safe for its polynomial, Horowitz-Ostrogradsky and
degree-1/2 log/arctan parts, but its RootSum branch (irreducible denominator
factors of degree >= 5) pre-empted Rubi's frequently simpler closed form and
produced RootSum antiderivatives the downstream check often cannot verify.

Add a RootSumMode {DEFER, EMIT} parameter to RationalIntegration.integrate():
  - Pre-Rubi, Integrate now calls it with DEFER. When the antiderivative is
    essentially a bare RootSum, DEFER returns F.NIL so Rubi gets first crack
    (like the existing degree-3/4 deferral). A mixed Log(..)+RootSum(..) is a
    Plus and is still emitted pre-Rubi, preserving form-safety and avoiding a
    DerivativeDivides/cancelGCD ClassCastException seen when such integrands
    are routed into Rubi.
  - Post-Rubi, a new first stage calls it with EMIT, so a pure degree->=5
    rational denominator that Rubi leaves unevaluated re-emits the identical
    RootSum. Output is unchanged except where Rubi has a simpler closed form.

The 3-arg integrate() wrapper delegates with EMIT, so existing callers
(RadicalSubstitution, IntegrateAlgorithmsTest) are unaffected. Full
matheclipse-core suite green (3509 tests, 0 failures/errors).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@axkr
axkr merged commit 7197c93 into master Jul 19, 2026
4 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