Ask Your Question

Typing in a command of an adding-to-infinity sum

asked 2018-08-11 10:14:11 -0500

pizza gravatar image

updated 2018-08-11 10:15:24 -0500

1/1-x = x^0+x^1+x^2+...

How can I type in such a command of an adding-to-infinity sum?

Urgent! If anyone have any answer or suggestion, please type in here! Thanks!

edit retag flag offensive close merge delete

3 answers

Sort by » oldest newest most voted

answered 2018-08-11 15:36:40 -0500

slelievre gravatar image

Depends if you want to input the series and get the sum of the series (in that case follow Eric's answer), or the converse, in which case you can ask for the series expansion.

sage: f = 1/(1-x)
sage: f.series(x)
1 + 1*x + 1*x^2 + 1*x^3 + 1*x^4 + 1*x^5 + 1*x^6 + 1*x^7 + 1*x^8
+ 1*x^9 + 1*x^10 + 1*x^11 + 1*x^12 + 1*x^13 + 1*x^14 + 1*x^15
+ 1*x^16 + 1*x^17 + 1*x^18 + 1*x^19 + Order(x^20)
edit flag offensive delete link more

answered 2018-08-11 13:44:53 -0500

eric_g gravatar image

Like this:

sage: assume(abs(x)<1)
sage: n = var('n')
sage: sum(x^n, n, 0, oo)
-1/(x - 1)
edit flag offensive delete link more

answered 2018-08-13 03:43:40 -0500

Emmanuel Charpentier gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-08-11 10:14:11 -0500

Seen: 44 times

Last updated: Aug 13