Hi I'm looking for a more elegant way of setting my array elements Using "for" loops it would be for i in range(rows): for j in range(cols): N[i,j] = N[i1][j] + N[i][j1]  N[i1][j1] It's sort of a combined 2d accumulate. Any ideas? Mathew
On 6/8/07, Mathew Yeates <mathewww@charter.net> wrote:
Hi I'm looking for a more elegant way of setting my array elements Using "for" loops it would be for i in range(rows): for j in range(cols): N[i,j] = N[i1][j] + N[i][j1]  N[i1][j1]
If the initial values of the recursion are in the first row and column you can use the result: N[i,j] = N[0,j] + N[i,0]. It's like the PDE D_xD_y N = 0 whose solution is the sum of two functions f(x) + g(y). It gets more complicated if you are looking for a more general result. Chuck
On 6/8/07, Charles R Harris <charlesr.harris@gmail.com> wrote:
On 6/8/07, Mathew Yeates <mathewww@charter.net> wrote:
Hi I'm looking for a more elegant way of setting my array elements Using "for" loops it would be for i in range(rows): for j in range(cols): N[i,j] = N[i1][j] + N[i][j1]  N[i1][j1]
If the initial values of the recursion are in the first row and column you can use the result: N[i,j] = N[0,j] + N[i,0]. It's like the PDE D_xD_y N = 0 whose solution is the sum of two functions f(x) + g(y). It gets more complicated if you are looking for a more general result.
Chuck
Make that N[i,j] = N[0,j] + N[i,0]  N[0,0]. Chuck
participants (2)

Charles R Harris

Mathew Yeates