ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 04 Sep 2018 11:49:43 +0200Typing in a command of an adding-to-infinity sumhttps://ask.sagemath.org/question/43339/typing-in-a-command-of-an-adding-to-infinity-sum/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!Sat, 11 Aug 2018 17:14:11 +0200https://ask.sagemath.org/question/43339/typing-in-a-command-of-an-adding-to-infinity-sum/Comment by slelievre for <p>1/1-x = x^0+x^1+x^2+...</p>
<p>How can I type in such a command of an adding-to-infinity sum?</p>
<p>Urgent! If anyone have any answer or suggestion, please type in here! Thanks!</p>
https://ask.sagemath.org/question/43339/typing-in-a-command-of-an-adding-to-infinity-sum/?comment=43576#post-id-43576Note that the question is about 1/(1 - x), not (1/1) - x.Tue, 04 Sep 2018 11:49:43 +0200https://ask.sagemath.org/question/43339/typing-in-a-command-of-an-adding-to-infinity-sum/?comment=43576#post-id-43576Answer by slelievre for <p>1/1-x = x^0+x^1+x^2+...</p>
<p>How can I type in such a command of an adding-to-infinity sum?</p>
<p>Urgent! If anyone have any answer or suggestion, please type in here! Thanks!</p>
https://ask.sagemath.org/question/43339/typing-in-a-command-of-an-adding-to-infinity-sum/?answer=43342#post-id-43342Depends 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)
Sat, 11 Aug 2018 22:36:40 +0200https://ask.sagemath.org/question/43339/typing-in-a-command-of-an-adding-to-infinity-sum/?answer=43342#post-id-43342Answer by Emmanuel Charpentier for <p>1/1-x = x^0+x^1+x^2+...</p>
<p>How can I type in such a command of an adding-to-infinity sum?</p>
<p>Urgent! If anyone have any answer or suggestion, please type in here! Thanks!</p>
https://ask.sagemath.org/question/43339/typing-in-a-command-of-an-adding-to-infinity-sum/?answer=43357#post-id-43357`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.
Mon, 13 Aug 2018 10:43:40 +0200https://ask.sagemath.org/question/43339/typing-in-a-command-of-an-adding-to-infinity-sum/?answer=43357#post-id-43357Answer by eric_g for <p>1/1-x = x^0+x^1+x^2+...</p>
<p>How can I type in such a command of an adding-to-infinity sum?</p>
<p>Urgent! If anyone have any answer or suggestion, please type in here! Thanks!</p>
https://ask.sagemath.org/question/43339/typing-in-a-command-of-an-adding-to-infinity-sum/?answer=43341#post-id-43341Like this:
sage: assume(abs(x)<1)
sage: n = var('n')
sage: sum(x^n, n, 0, oo)
-1/(x - 1)
Sat, 11 Aug 2018 20:44:53 +0200https://ask.sagemath.org/question/43339/typing-in-a-command-of-an-adding-to-infinity-sum/?answer=43341#post-id-43341