Some code for Lagrange inversion has been posted on the "generic power series reversion" trac ticket: http://trac.sagemath.org/sage_trac/ticket/7644
The code doesn't quite run, since it references some other function (ps_coefficient); here's an updated version which uses only built-in functions: def ps_inverse_Lagrange(f): if f.valuation() != 1: raise ValueError, "series must have valuation one for reversion" if f.prec() is infinity: raise ValueError, "series must have finite precision for reversion" t = parent(f).gen() h = t/f k = 1 g = 0 for i in range(1, f.prec()): k *= h g += (1/i)*k.padded_list(i)[i - 1]*t^i g += O(t^f.prec()) return g On Dec 9, 3:20 pm, William Stein <wst...@gmail.com> wrote: > On Wed, Dec 9, 2009 at 10:50 AM, Matt Bainbridge > > <bainbridge.m...@gmail.com> wrote: > > Its easy enough to code this in sage. This seems to work over any > > field: > > Thanks. This is now http://trac.sagemath.org/sage_trac/ticket/7644 > > > > > > > def ps_inverse(f): > > if f.prec() is infinity: > > raise ValueError, "series must have finite precision for > > reversion" > > if f.valuation() != 1: > > raise ValueError, "series must have valuation one for > > reversion" > > t = parent(f).gen() > > a = 1/f.coefficients()[0] > > g = a*t > > for i in range(2, f.prec()): > > g -= ps_coefficient((f + O(t^(i+1)))(g),i)*a*t^i > > g += O(t^f.prec()) > > return g > > > def ps_coefficient(f,i): > > if i >= f.prec(): > > raise ValueError, "that coefficient is undefined" > > else: > > return f.padded_list(f.prec())[i] > > > -- > > To post to this group, send email to sage-support@googlegroups.com > > To unsubscribe from this group, send email to > > sage-support+unsubscr...@googlegroups.com > > For more options, visit this group > > athttp://groups.google.com/group/sage-support > > URL:http://www.sagemath.org > > -- > William Stein > Associate Professor of Mathematics > University of Washingtonhttp://wstein.org -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org