AbstractAlgebra.jl icon indicating copy to clipboard operation
AbstractAlgebra.jl copied to clipboard

Add `coefficients(a::AbsPowerSeriesRingElem)`

Open lgoettgens opened this issue 1 year ago • 10 comments

lgoettgens avatar Sep 26 '24 13:09 lgoettgens

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.03%. Comparing base (efb6ceb) to head (73f0fdc). Report is 16 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1811   +/-   ##
=======================================
  Coverage   88.03%   88.03%           
=======================================
  Files         119      119           
  Lines       30057    29995   -62     
=======================================
- Hits        26460    26406   -54     
+ Misses       3597     3589    -8     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Sep 26 '24 13:09 codecov[bot]

@fieker does that make sense?

thofma avatar Sep 27 '24 11:09 thofma

Ok, so what I wanted to add is a function that gives me all coefficients (as coeff does for a single one), but skipping the infinite sequence of zeros in the end. If there is any other clean way to get this, I am happy with using that instead as well.

lgoettgens avatar Sep 27 '24 12:09 lgoettgens

you need to be thinking about what you want: you want the leading zeros? If the element has a valuation? @lgoettgens what do you need/ want? I think for polys we allow access past the degree - to get 0, for power series (and Laurent) even going to -infty would make sense

fieker avatar Sep 27 '24 13:09 fieker

I don't really care about leading zeros. I think having coefficients(a)[i] == coeff(a, i-1) work for all indices of coefficients(a) would be nice (this is as it is for polys).

lgoettgens avatar Sep 27 '24 13:09 lgoettgens

Bump

lgoettgens avatar Oct 01 '24 09:10 lgoettgens

It is not clear to me that this right thing. length is not part of the interface and exporting pol_length was a mistake in the first place.

A faithful representation of the power series would need to include the coefficients up precision(x) - 1.

thofma avatar Oct 01 '24 12:10 thofma

That's true. I adapted the function an tests accordingly.

lgoettgens avatar Oct 01 '24 13:10 lgoettgens

Off-topic, but: this function looks to me like another example of an extrep function as proposed in https://github.com/oscar-system/Oscar.jl/issues/4151. Which then raises the natural question: do we also have a reverse that takes such a coefficient list and turns it back into a series? E.g. a == parent(a)(coefficients(a)) ?

fingolfin avatar Oct 01 '24 22:10 fingolfin

@fieker this now goes up to precision(x) -1. Are you happy with this?

thofma avatar Oct 02 '24 06:10 thofma

Unfortunately, due to branch names being weird, this has to get force-merged. @fingolfin @thofma could you do the favor?

lgoettgens avatar Oct 07 '24 10:10 lgoettgens