Hi Zach!

On Feb 11, 2:37 pm, zsharon <[email protected]> wrote:
> This should also work:
>
> R.<z> = PowerSeriesRing(ZZ)
> z+1
> #1+z

I am a bit surprised that it works, because I thought that
PowerSeriesRing comes with a default precision of 20. So, I thought
that any polynomial would be cut off in degree 20.

But indeed it isn't:
sage: R.<t> = ZZ[]
sage: S = PowerSeriesRing(ZZ,['t'])
sage: p = R.random_element()
sage: p
t^2 + t - 1
sage: S(p)
-1 + t + t^2
sage: S(p^20)
1 - 20*t + 170*t^2 - 760*t^3 + 1615*t^4 + 456*t^5 - 10830*t^6 +
19380*t^7 + 14535*t^8 - 90440*t^9 + 52972*t^10 + 206720*t^11 -
287470*t^12 - 284240*t^13 + 717060*t^14 + 224808*t^15 - 1235475*t^16 -
39900*t^17 + 1653950*t^18 - 125800*t^19 - 1813055*t^20 + 125800*t^21 +
1653950*t^22 + 39900*t^23 - 1235475*t^24 - 224808*t^25 + 717060*t^26 +
284240*t^27 - 287470*t^28 - 206720*t^29 + 52972*t^30 + 90440*t^31 +
14535*t^32 - 19380*t^33 - 10830*t^34 - 456*t^35 + 1615*t^36 + 760*t^37
+ 170*t^38 + 20*t^39 + t^40

Apparently the cutting off only occurs if one actually has an infinite
series, such as
sage: 1/S(p)
-1 - t - 2*t^2 - 3*t^3 - 5*t^4 - 8*t^5 - 13*t^6 - 21*t^7 - 34*t^8 -
55*t^9 - 89*t^10 - 144*t^11 - 233*t^12 - 377*t^13 - 610*t^14 -
987*t^15 - 1597*t^16 - 2584*t^17 - 4181*t^18 - 6765*t^19 + O(t^20)

So, this does indeed solve my problem. Thanks a lot!

Simon

-- 
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

Reply via email to