Suggestions for translating a Do[] loop ...
- To: mathgroup at smc.vnet.net
- Subject: [mg69773] Suggestions for translating a Do[] loop ...
- From: "David Annetts" <davidannetts at aapt.net.au>
- Date: Fri, 22 Sep 2006 01:05:07 -0400 (EDT)
Hi, Given that a, b & r are lists of the same length, can anyone suggest a translation of the following Do[] loop to something functional? It looks like an ideal application for Fold, but for me, the loop going backwards is really obscuring things. The loop is Do[ r[[j]] = a[[j]] * (b[[j]] + r[[j + 1]]) / (1 + b[[j]] * r[[j + 1]]), {j, Length@a - 1, 1, -1} ]; with r[[Length@a]] = 0. Many thanks, Dave.
- Follow-Ups:
- Re: Suggestions for translating a Do[] loop ...
- From: Sseziwa Mukasa <mukasa@jeol.com>
- Re: Suggestions for translating a Do[] loop ...