Ask Your Question
1

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

asked 2018-08-11 17:14:11 +0100

pizza gravatar image

updated 2018-08-11 17:15:24 +0100

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

Comments

Note that the question is about 1/(1 - x), not (1/1) - x.

slelievre gravatar imageslelievre ( 2018-09-04 11:49:43 +0100 )edit

3 Answers

Sort by » oldest newest most voted
2

answered 2018-08-11 22:36:40 +0100

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
3

answered 2018-08-11 20:44:53 +0100

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
1

answered 2018-08-13 10:43:40 +0100

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

Stats

Asked: 2018-08-11 17:14:11 +0100

Seen: 545 times

Last updated: Aug 13 '18