Defer Evaluating RootSums - #1430
Merged
Merged
Conversation
…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>
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.
Thanks for contributing.
Description
Before producing
RootSumexpressions in the Integrate tool chain, let the Rubi integration engine search fo simplerIntegratesolutions.