Ticket #5109 (closed enhancement: fixed)
[with patch, positive review] add support for Bell polynomials in Sage
| Reported by: | mhansen | Owned by: | mhansen |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-3.3 |
| Component: | combinatorics | Keywords: | |
| Cc: | sage-combinat | Work issues: | |
| Report Upstream: | Reviewers: | ||
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description
Attachments
Change History
comment:1 Changed 4 years ago by mhansen
- Summary changed from add support for Bell polynomials in Sage to [with patch, needs review] add support for Bell polynomials in Sage
comment:2 Changed 4 years ago by wdj
- Summary changed from [with patch, needs review] add support for Bell polynomials in Sage to [with patch, positive review] add support for Bell polynomials in Sage
This applies cleanly to 3.3.alpha2 and passes sage -t. The examples also agree with some examples given on http://en.wikipedia.org/wiki/Bell_polynomials, as well as this agreement:
sage: stirling_number2(6,2) == bell_polynomial(6,2)(1,1,1,1,1) True sage: stirling_number2(6,4) == bell_polynomial(6,4)(1,1,1) True sage: stirling_number2(7,4) == bell_polynomial(7,4)(1,1,1,1) True
I ran sage -testall and got this failure:
sage -t "devel/sage/sage/rings/polynomial/toy_d_basis.py"
**********************************************************************
File "/Volumes/G-DRIVE-MINI/sagestuff/sage-3.3.alpha2/devel/sage/sage/rings/polynomial/toy_d_basis.py", line 91:
sage: d_basis(I)
Expected:
[x + 170269749119, y + 2149906854, z + 735710619426, 282687803443]
Got:
[x + 170269749119, y + 2149906854, z + 170335012540, 282687803443]
**********************************************************************
Though I don't know what a d_basis is, I think it is an unrelated failure so I'm giving this a positive review.
comment:3 Changed 4 years ago by wdj
One more test (also positive):
sage: n=6 sage: add([bell_polynomial(n,i)((1,)*(n-i+1)) for i in range(1,n+1)]) == bell_number(n) True sage: n = 7 sage: add([bell_polynomial(n,i)((1,)*(n-i+1)) for i in range(1,n+1)]) == bell_number(n) True sage: n = 8 sage: add([bell_polynomial(n,i)((1,)*(n-i+1)) for i in range(1,n+1)]) == bell_number(n) True sage: n = 20 sage: add([bell_polynomial(n,i)((1,)*(n-i+1)) for i in range(1,n+1)]) == bell_number(n) True sage: bell_number(n) 51724158235372
Returns these pretty fast too!
comment:4 Changed 4 years ago by mabshoff
Note that partial credit goes to Blair - see
http://groups.google.com/group/sage-devel/browse_thread/thread/4ae02fd827f68eed#
Cheers,
Michael
comment:5 Changed 4 years ago by mhansen
- Status changed from new to assigned
Yep, I did the patch in his name.
comment:6 Changed 4 years ago by mabshoff
I got Blair's "real name" from the hg commit message, but I pinged him to see if he wants to be credited with that name or not.
Cheers,
Michael

