Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

slelièvre's answer gives a finite series, completed byy an O(n) term.. If you want the (supposedly exact) infinite series, you have (at least) two possibilities :

  • Maxima's powerseries does the job :

    sage: (1/(1-x)).maxima_methods().powerseries(x,0)

    sum(x^i1, i1, 0, +Infinity)

  • Sympy''s summation does it also :

    sage: sympy.summation(x^j,(j,0,oo))

    Piecewise((1/(-x + 1), Abs(x) < 1), (Sum(x**j, (j, 0, oo)), True))

Sympy's solution is better (it gives the conditions of validity of the result), but currently can't be automatically transtaled to Sage, because Sympy's Sum method does not (yet) have a _sage_() method.