Jon, Thank you. That was my question.
________________________________________ From: [email protected] [[email protected]] On Behalf Of Jonathan Bober [[email protected]] Sent: Thursday, October 08, 2009 12:09 PM To: [email protected] Subject: [sage-support] Re: Summation The trac ticket listed in the other email is relevant for symbolic summation, when you want to represent 1 + x^2 + ... + x^n for n a symbolic variable. It looks like you just want to do this for a fixed number, such as n = 10. For this, you can write sage: sum(x^i for i in (0..10)) x^10 + x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + x + 1 or sage: sum(x^i for i in (0..100)) x^100 + x^99 + x^98 + x^97 + x^96 + x^95 + x^94 + x^93 + x^92 + x^91 + x^90 + x^89 + x^88 + x^87 + x^86 + x^85 + x^84 + x^83 + x^82 + x^81 + x^80 + x^79 + x^78 + x^77 + x^76 + x^75 + x^74 + x^73 + x^72 + x^71 + x^70 + x^69 + x^68 + x^67 + x^66 + x^65 + x^64 + x^63 + x^62 + x^61 + x^60 + x^59 + x^58 + x^57 + x^56 + x^55 + x^54 + x^53 + x^52 + x^51 + x^50 + x^49 + x^48 + x^47 + x^46 + x^45 + x^44 + x^43 + x^42 + x^41 + x^40 + x^39 + x^38 + x^37 + x^36 + x^35 + x^34 + x^33 + x^32 + x^31 + x^30 + x^29 + x^28 + x^27 + x^26 + x^25 + x^24 + x^23 + x^22 + x^21 + x^20 + x^19 + x^18 + x^17 + x^16 + x^15 + x^14 + x^13 + x^12 + x^11 + x^10 + x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + x + 1 On Thu, 2009-10-08 at 08:33 -0500, Kim, In-Jae wrote: > Hello, > > I was wondering how I can write the polynomial, 1+x+x^2 + ...+x^10, using > summation. > I tried > sage: var('i,x') > sage: sum(x^i, (i,0,10)), > > but I got the following error message: > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/home/sage/sagenb/sage_notebook/worksheets/matrix89/26/code/6.py", > line 7, in <module> > sympy.sum(x**i, (i,_sage_const_0 ,_sage_const_10 )) > File "", line 1, in <module> > > NameError: name 'sympy' is not defined > > Thank you. > > In-Jae > --~--~---------~--~----~------------~-------~--~----~ 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-support URL: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
