Implement conversion from laurent series to rational function field #39485
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.
As in the title. I think this behavior makes sense because
QQ(RR(…))
currently uses.simplest_rational()
instead of like exact value (likex / 2^53
for some integerx
), so it makes sense for similar conversions to compute a good approximation too.I cannot prove that this round-trips, however.
Note that currently conversion from power series
QQ[[x]]
to polynomial ringQQ[x]
truncates, because of implementation detail this leads to conversion fromQQ[[x]]
toFrac(QQ[x])
also truncates. I think this is undesirable behavior because identical-looking elements inQQ[[x]]
versusFrac(QQ[[x]]) = LaurentSeriesRing(QQ, "x")
has different conversion behavior.Elements which are already Laurent polynomial are preserved.
Side note:
.one()
is faster because it's cachedMaybe this doesn't need to be explicitly written in the documentation (users trying to do the conversion will just see the result)
There exists also
:meth:`.PowerSeries_poly.pade`
which should probably be mentioned in the documentation.Reverse direction (that one is a morphism): #39365
Possible caveat:
It could be argued the latter would be simpler as
1/(x^31+x^30)
, but then that way gives higher denominator degree.📝 Checklist
⌛ Dependencies