Dear all,

I discovered a weird bug on power series when computing the inverse of a
serie. Look at this.

This computation gives the expected result

sage: L.<z> = LazyPowerSeriesRing(QQ)

sage: f = 1 - z - z^2

sage: b = ~f

sage: b.compute_coefficients(10)

sage: b

1 + z + 2*z^2 + 3*z^3 + 5*z^4 + 8*z^5 + 13*z^6 + 21*z^7 + 34*z^8 + 55*z^9 +
89*z^10 + O(x^11)

But not this one:

sage: L.<z> = LazyPowerSeriesRing(QQ)

sage: f = 1 - z - z^2

sage: f.compute_coefficients(10)

sage: f

1 - z - z^2 + O(x^11)
sage: b = ~f

sage: b.compute_coefficients(10)

sage: b

1 + z^1 + z^2 + z^3 + ...

Another example with Catalan numbers

sage: L.<z> = LazyPowerSeriesRing(QQ)
sage: C = L()

sage: C.define(1 + z*C*C)

sage: Cinv = ~C

sage: Cinv.compute_coefficients(10); Cinv

1 - z - z^2 - 2*z^3 - 5*z^4 - 14*z^5 - 42*z^6 - 132*z^7 - 429*z^8 -
1430*z^9 - 4862*z^10 + O(x^11)

sage: C = L()

sage: C.define(1 +z*C*C)

sage: C.compute_coefficients(10);C

1 + z + 2*z^2 + 5*z^3 + 14*z^4 + 42*z^5 + 132*z^6 + 429*z^7 + 1430*z^8 +
4862*z^9 + 16796*z^10 + O(x^11)
sage: Cinv = ~C

sage: Cinv.compute_coefficients(10);Cinv

1 + z^1 + z^2 + z^3 + ...

How Come??

This is Sage 9.2. I haven't tried on other versions

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAPAYYh7JR98QgXPyF43%3DRVABnaBviVcQB-aTO5kCsywribWzMw%40mail.gmail.com.

Reply via email to