You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add absolute PolyRatFun expansion and fix relative mode - #926
This PR completes support for absolute expansion depths in PolyRatFun and documents the feature. The compiler routine and parts of ExpandRat in ratio.c already contained partial support, but the implementation was incomplete.
The syntax supports positive and negative cutoffs:
Truncate expansions consistently for single-symbol denominators. At relative depth 5, rat(1+ep+...+ep^10,ep) now stops at ep^4, matching the general polynomial-denominator path.
Preserve symbols used as numerator coefficients, including cases such as rat(a^3,ep) and rat(a^3,16).
Apply fixed cutoffs correctly when multiplying expanded functions across modules.
Questions for review:
How should non-symbol numerators such as p1.p2 and single-argument inputs such as rat(a^2) be handled? These inputs currently crash.
finddivergence is an alias for the documented divergence mode. Should we keep finddivergence as a keyword?
I think non-symbol content should be forbidden. While it is allowed in gcd_ etc with LocalConvertToPoly, it has not ever been allowed in PolyRatFun arguments, and this is just a special PolyRatFun mode. We should terminate with an error. Actually, I think it would be very useful if for this, and for PolyRatFun in general, the error message actually printed the term with the non-symbol content. It is annoying when you have a termination due to a PolyRatFun argument somewhere within an expression of millions on terms, and you have to work out what exactly is wrong.
If finddivergence was never documented and is just an alias, I would say we should remove it and not over-complicate things with unnecessary extra keywords.
For your second bullet point: are you saying that actually expansion of multivariate rational polynomials is supported? If not, this would also be a very nice feature to have. The code to do it with FLINT could be adapted from here: https://github.com/jodavies/ibppp/blob/main/include/flint_interface.hpp#L311
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
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.
This PR completes support for absolute expansion depths in
PolyRatFunand documents the feature. The compiler routine and parts ofExpandRatinratio.calready contained partial support, but the implementation was incomplete.The syntax supports positive and negative cutoffs:
The previously undocumented
relativekeyword is also documented. It selects the default expansion mode, so the following two are equivalent:This PR also fixes several expansion paths:
rat(1+ep+...+ep^10,ep)now stops atep^4, matching the general polynomial-denominator path.rat(a^3,ep)andrat(a^3,16).Questions for review:
p1.p2and single-argument inputs such asrat(a^2)be handled? These inputs currently crash.finddivergenceis an alias for the documenteddivergencemode. Should we keepfinddivergenceas a keyword?