#7644: generic power series reversion
---------------------------+------------------------------------------------
   Reporter:  was          |       Owner:  AlexGhitza
       Type:  enhancement  |      Status:  new       
   Priority:  major        |   Milestone:  sage-4.3  
  Component:  algebra      |    Keywords:            
Work_issues:               |      Author:            
   Upstream:  N/A          |    Reviewer:            
     Merged:               |  
---------------------------+------------------------------------------------

Comment(by fwclarke):

 Lagrange inversion is significantly faster.  With
 {{{
 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)*ps_coefficient(k, i - 1)*t^i
    g += O(t^f.prec())
    return g
 }}}
 I found
 {{{
 sage: R.<x> = QQ[[]]
 sage: f = exp(x) - 1
 sage: timeit('ps_inverse(f)')
 5 loops, best of 3: 552 ms per loop
 sage: timeit('ps_inverse_Lagrange(f)')
 5 loops, best of 3: 74 ms per loop
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7644#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

--

You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.


Reply via email to