Weird power series bug

已查看 49 次
跳至第一个未读帖子

Viviane Pons

未读,
2020年12月11日 04:16:332020/12/11
收件人 Sage devel
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

Frédéric Chapoton

未读,
2020年12月11日 05:03:592020/12/11
收件人 sage-devel
Salut,
Le code sur les espèces est connu pour être farci de bugs, et personne ne s'en est préoccupé depuis très longtemps.
cf https://trac.sagemath.org/ticket/30727
Fred

Martin R

未读,
2020年12月11日 14:26:462020/12/11
收件人 sage-devel
I am planning to organize sagespeciesdays for February, with making lazy power series sane as a subgoal.  It would be extremely motivating if some people put themselves into the CC field of the ticket Frédéric pointed out, to signal interest.

Best wishes,

Martin

Kwankyu Lee

未读,
2020年12月11日 18:59:522020/12/11
收件人 sage-devel
Hi,

Meanwhile, lazy Laurent series ring is also available.

sage: L.<z> = LazyLaurentSeriesRing(QQ)                                                                                    
sage: f = 1 - z - z^2                                                                                                      
sage: b = ~f                                                                                                               
sage: b.coefficient(10)                                                                                                    
89
sage: b                                                                                                                    
1 + z + 2*z^2 + 3*z^3 + 5*z^4 + 8*z^5 + 13*z^6 + ...
sage: C = L.series(lambda s,n: (1 + z*s^2)[n], valuation=0)                                                                
sage: C.coefficient(10)                                                                                                    
16796
sage: C                                                                                                                    
1 + z + 2*z^2 + 5*z^3 + 14*z^4 + 42*z^5 + 132*z^6 + ...


Samuel Lelievre

未读,
2020年12月11日 19:44:152020/12/11
收件人 sage-devel
2020-12-11 19:26:46 UTC, Martin:
I am planning to organize sagespeciesdays for February,
with making lazy power series sane as a subgoal.  It would be
extremely motivating if some people put themselves into
the CC field of the ticket Frédéric pointed out, to signal interest.

Suggestion: open a stream on zulip for people to register.
回复全部
回复作者
转发
0 个新帖子