Ask Your Question
0

Iterated functional composition

asked 2012-02-29 22:59:12 -0500

petropolis gravatar image

I try to translate a Maple function computing OEIS A144150 as given in [1]:

g := proc(p) local b; 
    b := proc(n) option remember; local k;
        `if`(n=0,1,add(binomial(n-1,k-1)*p(k)*b(n-k),k=1..n)) 
end end: 

A144150 := (n, k) -> (g@@k)(1)(n);

seq(print(seq(A144150(n,k),k=0..8)),n=0..5);

I am somewhat clueless how to achieve this with Sage. Google found [2] which highlights the problem but does not give an answer.

[1] http://oeis.org/A144150
[2] http://groups.google.com/group/sage-support/browse_thread/thread/9cda87e8889b6ead/
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2012-03-01 05:57:23 -0500

niles gravatar image

Does this StackOverflow queston on repeated function application solve your problem?

Python's while/yield generator syntax might also be useful for this.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-02-29 22:59:12 -0500

Seen: 395 times

Last updated: Mar 01 '12