Ask Your Question
1

laurent series

asked 2022-04-04 15:55:45 +0100

Hartmut Monien gravatar image

Is the number of terms of a Laurent series fixed? E.g.

P.<t> = LaurentSeriesRing(QQ)
1/P([1 for t in range(100)])

yields

1 - t + O(t^20)

and not

1 - t + O(t^100)

as expected. There seems to be no simple way of setting the "precision" of the series. Or is there ... ?

edit retag flag offensive close merge delete

Comments

Do you guys know how to expand in Laurent series around infinity and not 0? I tried to substitute a new variable, like

z=var('z')
expression.subs(t=1/z).series(z,0)

But it happens for some complicated expression to retrieve the error

ValueError: power::eval(): division by zero.

Can anyone please help me?

AndreaMelcarne gravatar imageAndreaMelcarne ( 2024-09-09 14:42:11 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-04-04 16:43:03 +0100

tmonteil gravatar image

updated 2022-04-04 16:44:04 +0100

This is due to the fact that:

sage: P.default_prec()
20

You can set another default_prec when you define P:

sage: P.<t> = LaurentSeriesRing(QQ, default_prec=100)
sage: 1/P([1 for t in range(100)])
1 - t + O(t^100)

Alternatively, you can set a precision to the element you want to invert :

sage: P.<t> = LaurentSeriesRing(QQ)
sage: P.default_prec()
20
sage: a = P([1 for t in range(100)])
sage: a
1 + t + t^2 + t^3 + t^4 + t^5 + t^6 + t^7 + t^8 + t^9 + t^10 + t^11 + t^12 + t^13 + t^14 + t^15 + t^16 + t^17 + t^18 + t^19 + t^20 + t^21 + t^22 + t^23 + t^24 + t^25 + t^26 + t^27 + t^28 + t^29 + t^30 + t^31 + t^32 + t^33 + t^34 + t^35 + t^36 + t^37 + t^38 + t^39 + t^40 + t^41 + t^42 + t^43 + t^44 + t^45 + t^46 + t^47 + t^48 + t^49 + t^50 + t^51 + t^52 + t^53 + t^54 + t^55 + t^56 + t^57 + t^58 + t^59 + t^60 + t^61 + t^62 + t^63 + t^64 + t^65 + t^66 + t^67 + t^68 + t^69 + t^70 + t^71 + t^72 + t^73 + t^74 + t^75 + t^76 + t^77 + t^78 + t^79 + t^80 + t^81 + t^82 + t^83 + t^84 + t^85 + t^86 + t^87 + t^88 + t^89 + t^90 + t^91 + t^92 + t^93 + t^94 + t^95 + t^96 + t^97 + t^98 + t^99

sage: a.prec()
+Infinity

sage: a = a.O(100)
sage: a
1 + t + t^2 + t^3 + t^4 + t^5 + t^6 + t^7 + t^8 + t^9 + t^10 + t^11 + t^12 + t^13 + t^14 + t^15 + t^16 + t^17 + t^18 + t^19 + t^20 + t^21 + t^22 + t^23 + t^24 + t^25 + t^26 + t^27 + t^28 + t^29 + t^30 + t^31 + t^32 + t^33 + t^34 + t^35 + t^36 + t^37 + t^38 + t^39 + t^40 + t^41 + t^42 + t^43 + t^44 + t^45 + t^46 + t^47 + t^48 + t^49 + t^50 + t^51 + t^52 + t^53 + t^54 + t^55 + t^56 + t^57 + t^58 + t^59 + t^60 + t^61 + t^62 + t^63 + t^64 + t^65 + t^66 + t^67 + t^68 + t^69 + t^70 + t^71 + t^72 + t^73 + t^74 + t^75 + t^76 + t^77 + t^78 + t^79 + t^80 + t^81 + t^82 + t^83 + t^84 + t^85 + t^86 + t^87 + t^88 + t^89 + t^90 + t^91 + t^92 + t^93 + t^94 + t^95 + t^96 + t^97 + t^98 + t^99 + O(t^100)

sage: a.prec()
100

sage: 1/a
1 - t + O(t^100)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2022-04-04 15:55:45 +0100

Seen: 561 times

Last updated: Apr 04 '22