On Wed, 27 Apr 2005 11:34:53 GMT, "chris" <[EMAIL PROTECTED]> wrote:
>The problem I have is as follows: > >I have a recursive function b(k) > >b(k) = -(A/k**2)*(b(k-2) - b(k-5)) >k<0, b(k)=0 >k=0, b(k)=1 >k=1, b(k)=0 > >eg. b(2) = -A/4 > b(3) = 0 > b(4) = A**2/64 > >note that as k increases b(k) can itself be a sum of terms in powers of A >rather than a single power of A in the examples above. > >Summing all terms and equating to zero gives: > >F= sum b(k) = 0 for all k = 0, infinity > >When this is expanded I get a polynomial F(A). I want to determine the >coefficients of the polynomial so that I can find the roots of the function >F up to a specified order of A. > > >I have yet to code this but I was hoping for some ideas on how to do this >reasonably. > >I figure I can compute each b(k) and store the numeric value(s) and >associated powers of A. Then collect coefficients for like powers of A. >Finally I have a set of polynomial coefficients in A which I can pass to >scipy.base.roots() > >Any suggestions on how I might do this efficiently? I have no doubt I can >get this done with brute force, but I would prefer to explore more elegant >means which I look to the masters for. > Does this look right? b(-5) -> 0 b(-4) -> 0 b(-3) -> 0 b(-2) -> 0 b(-1) -> 0 b(0) -> 0 b(1) -> 0 b(2) -> -A/4 b(3) -> 0 b(4) -> A**2/64 b(5) -> A/25 b(6) -> -A**3/2304 b(7) -> -29*A**2/4900 b(8) -> A**4/147456 b(9) -> 563*A**3/2116800 b(10) -> A**2/2500 -A**5/14745600 b(11) -> -5927*A**4/1024531200 b(12) -> -43*A**3/980000 +A**6/2123366400 b(13) -> 824003*A**5/11081329459200 b(14) -> 16397*A**4/10372320000 -A**7/416179814400 b(15) -> A**3/562500 -1260403*A**6/1994639302656000 Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list