On Thursday, June 2, 2016 at 11:29:34 AM UTC-7, saad khalid wrote:
>
> Hey everyone:
>
> So, there are some infinite sums that I would like to see computed out to
> around 20 terms, just so I can kind of see what form its taking. The
> problem is that it's a bit difficult to do by hand, and I'll be changing
> the parameters several times which means I would have to do it several
> times. I was wondering if there was any way to do it in sage. The type of
> thing I want would be like \sum_{k=1}^{20} (5^k)(y_k). So, the part that I
> don't know how to do is have it output y_k. I don't even necessarily need
> it to generate y_k as a variable that I can plug things in to, I just want
> it to output it so that I can see the form of the equation, if that makes
> sense. Thank you!
>
> You can get a list of symbols by just constructing them:
sage: y = [SR("y%s"%i) for i in [0..20]]
or if you want to get fancy (and you know what kind of coefficients you
have) you can use an "infinite polynomial ring"
sage: R.<y> = InfinitePolynomialRing(QQ)
in either case you can construct your sum by doing something along the
lines of
sum([5^k*y[k] for k in [1..20]])
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.