Precision for inverse polynomials

This might be an obvious question, but how do you change the number of terms shown for in inverse polynomial? I have a polynomial, which I name eisen in my code, which is:

1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + 60480*q^6 + 82560*q^7 + 140400*q^8 + 181680*q^9 + 272160*q^10 + 319680*q^11 + 490560*q^12 + 527520*q^13 + 743040*q^14 + 846720*q^15 + 1123440*q^16 + 1179360*q^17 + 1635120*q^18 + 1646400*q^19 + 2207520*q^20 + 2311680*q^21 + 2877120*q^22 + 2920320*q^23 + 3931200*q^24 + 3780240*q^25 + 4747680*q^26 + 4905600*q^27 + 6026880*q^28 + 5853600*q^29


And I would like to calculate the inverse of this polynomial, up to O(q^30). However, what I get when I enter (eisen)^(-1) is:

1 - 240*q + 55440*q^2 - 12793920*q^3 + 2952385680*q^4 - 681306078240*q^5 + 157221316739520*q^6 - 36281112432850560*q^7 + 8372395974330234000*q^8 - 1932052510261208053680*q^9 + 445849302141400152457440*q^10 - 102886230661038692118348480*q^11 + 23742498662203277988768469440*q^12 - 5478927929451211228257360565920*q^13 + 1264342548070079096527645691391360*q^14 - 291765487599771712002077691406849920*q^15 + 67329142631696181086152506843238511760*q^16 - 15537181881284423393192481036645057742560*q^17 + 3585431380474292447563107175964481073840080*q^18 - 827390596461696991629836522119620115607496000*q^19 + O(q^20)


I'm just not sure where to specify the precision, since there is nowhere to enter arguments, since exponentiation is just done by ^.

edit retag close merge delete

Never mind, I figured it out. I changed the precision of the PowerSeriesRing, but it still didn't work. However, after changing the precision, if I then recalculate eisen itself, then recalculate the inverse, it gives the right precision.

( 2022-02-02 18:09:48 +0200 )edit
1

For future user's sake, you should write up your answer to your own question and post it as such.

Perusing archives is a great way to get the hang of Sage...

( 2022-02-02 18:15:01 +0200 )edit

Sort by » oldest newest most voted

Never mind, I figured it out. I changed the precision of the PowerSeriesRing, but it still didn't work. However, after changing the precision, if I then recalculate eisen itself, then recalculate the inverse, it gives the right precision

more

(eisen + O(q^30))^(-1) should do the job.

more