On Thursday, June 2, 2016 at 10:19:21 PM UTC+2, saad khalid wrote:
>
> Thanks for the quick reply! Could you explain, or tell me what to search,
> what exactly "SR("y%s"%i)" does?
>
It's SR("y%s"%i) or better SR("y%s" % i). The % is Python format string
substitution, like C's sprintf.
> Is SR Symbolic Ring? Also, the output for the sum is close to perfect,
> though it gives me:
>
> y1 + y10 + y11 + y12 + y13 + y14 + y15 + y16 + y17 + y18 + y19 + y2 + y20 +
> y3 + y4 + y5 + y6 + y7 + y8 + y9
>
>
Yes. This is a feature because any fancy string detection during ordering
would slow symbolic calculations considerably.
So, the order is a bit messed up. I wasn't sure if there was an easy way to fix
that.
>
>
If you think we need a pretty print function then please open a ticket.
> Also, running it with
>
> R.<y> = InfinitePolynomialRing(QQ)
> sum([5^k*y[k] for k in [1..20]])
>
> Seems to run for a very long time
>
Tell us too please how long. I get with 7.3beta3:
sage: %timeit sum([5^k*y[k] for k in [1..20]])
The slowest run took 5.17 times longer than the fastest. This could mean
that an i
ntermediate result is being cached.
1000 loops, best of 3: 264 µs per loop
sage: %timeit sum([5^k*y[k] for k in [1..20]])
1000 loops, best of 3: 268 µs per loop
sage: %timeit sum([5^k*y[k] for k in [1..20]])
1000 loops, best of 3: 263 µs per loop
Fast enough, I should say.
--
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.