Sequence of functions
- To: mathgroup at smc.vnet.net
- Subject: [mg24065] Sequence of functions
- From: "Souvik Banerjee" <s-banerjee at nwu.edu>
- Date: Thu, 22 Jun 2000 01:01:57 -0400 (EDT)
- Organization: Northwestern University, Evanston, IL, US
- Sender: owner-wri-mathgroup at wolfram.com
Dear MathGroup Members, I am having a problem with defining a sequence of functions. A highly simplified version of the problem is given below: Suppose I define a function as follows, where the argument B is another function and ls is a list of numbers: Fx[ft_] := Block[ {g, h}, Do[ g[i][t_] := Sum[h[j][t], {j, i - 1}]; (* usually a more complicated function of h[j][t], j=1,...,i-1 here *) Plot[g[i][t], {t, 0, 4}]; h[i][t_] := g[i][t]; (* usually a more complicated function of g[i][t] here *) Plot[h[i][t], {t, 0, 4}], {i, 1, 3}] ] and then suppose we call Fx as Fx[{1, 2, 3}] Then at the beginning of the second iteration it says that the recursion depth is exceeded. I believe that this is happening because when it tries to evaluate g[2][t] it looks for h[1][t], but now h[1][t] is getting (wrongly) defined in terms of the current i (= 2) and hence goes into the recursion. How to get around this problem? Thanks, -Souvik