September 27, 2016: refactoring and sync
In [64]:
    
%run "../src/start_session.py"
%run "../src/recurrences.py"
    
In [50]:
    
import oeis
    
In [3]:
    
s = oeis.oeis_search(id=48993)
    
    
In [4]:
    
s()
    
    Out[4]:
In [3]:
    
from sympy.functions.combinatorial.numbers import stirling
    
In [76]:
    
s = IndexedBase('s')
n, k = symbols('n k')
stirling_recurrence_spec = recurrence_spec(recurrence_eq=Eq(s[n+1, k+1], s[n, k] + (k+1)*s[n, k+1]), 
                                           recurrence_symbol=s, 
                                           variables=[n,k])
    
In [77]:
    
stirling_recurrence_spec
    
    Out[77]:
In [78]:
    
unfolded = stirling_recurrence_spec.unfold(depth=1)
    
In [79]:
    
unfolded
    
    Out[79]:
In [81]:
    
instantiated = unfolded.instantiate(strategy=raw(substitutions={n:9,k:4}))
instantiated
    
    Out[81]:
In [58]:
    
known_binomials = {s[n,k]:stirling(n,k) for n in [10,9,8] for k in range(2,6)}
checked = instantiated.instantiate(strategy=raw(substitutions=known_binomials))
checked
    
    Out[58]:
In [59]:
    
checked.subsume()
    
    Out[59]:
In [82]:
    
based_recurrence_spec = unfolded.instantiate(strategy=based(arity=doubly_indexed()))
based_recurrence_spec
    
    Out[82]:
In [83]:
    
based_recurrence_spec.subsume()
    
    Out[83]:
In [66]:
    
ipython_latex_description(rec_spec=stirling_recurrence_spec, depths=range(9), based_instantiation=False,
                          arity=doubly_indexed())
    
    Out[66]:
In [36]:
    
s = oeis.oeis_search(seq=[1,1,4,3,1,27,19,6,1,256,175,55,10,1])
    
    
In [37]:
    
s()
    
    Out[37]:
In [40]:
    
s = oeis.oeis_search(id=264428)
    
    
In [41]:
    
s()
    
    Out[41]:
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.