Replying to fwclarke:

I've been looking at this.

Thanks!

One concern is that for power series with rational coefficients the existing method using pari is a great deal faster, so that at least in this case the pari method should be retained.

Yes, especially if there is work in progress to support converting more rings to pari. I wrote a revised patch which first attempts to convert to pari and do reversion there, and then tries the Lagrange inversion if conversion to pari fails. I think that implementation means that this patch can be independent of #4376 -- it will simply perform better when that patch is included.

I also think it is sensible to be able to revert infinite precision series, either by specifying the desired precision or by using the parent's default precision.

Yes, upon further consideration I agree. I've made this and two other improvements:

- Given a power series with infinite precision and degree
`deg`

, it's reversion is computed with precision `deg + 1`

.
- Given a power series whose leading coefficient is not a unit, the code tries to pass to the fraction field of the base ring and compute the reversion there.
- Given a power series over a base ring of positive characteristic, the code tries to lift to a characteristic zero base (using
`.lift()`

), compute the reversion, and then push back down to the positive characteristic base. This works over finite fields and `Zmod(n)`

, but fails over a base ring like `Zmod(n)[x]`

.

Each of these is demonstrated with an example.