<br><br><div><span class="gmail_quote">On 6/8/07, <b class="gmail_sendername">Charles R Harris</b> <<a href="mailto:charlesr.harris@gmail.com">charlesr.harris@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br><div><span class="q"><span class="gmail_quote">On 6/8/07, <b class="gmail_sendername">Mathew Yeates</b> <<a href="mailto:mathewww@charter.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
mathewww@charter.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi<br>I'm looking for a more elegant way of setting my array elements<br>Using "for" loops it would be<br>for i in range(rows):<br>    for j in range(cols):<br>       N[i,j] = N[i-1][j] + N[i][j-1] - N[i-1][j-1]
</blockquote></span><div><br>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.
<br><br>Chuck</div></div></blockquote><div><br>Make that  N[i,j] = N[0,j] + N[i,0] - N[0,0].<br><br>Chuck<br></div><br></div><br>