Re: decrementing problem
- To: mathgroup at smc.vnet.net
- Subject: [mg72311] Re: decrementing problem
- From: "Roman" <rschmied at gmail.com>
- Date: Tue, 26 Dec 2006 04:34:57 -0500 (EST)
- References: <em60nv$3ar$1@smc.vnet.net>
the documentation for For says: "The For exits as soon as test fails." You probably misinterpreted this part. If your n is <= 2, your loop never stops; if n is > 2, nothing is being done. Try with the condition "i >= 1" instead. jltrahan at mail.usf.edu wrote: > Hi, > I am having a really difficult time with decrementing values in my For > loop. I have tried i--, --i, i-=1, i=i-1, and nothing is working. The loop > is as follows: > For[i=n-1, i<=1, i--, summ=0; > For[j=i+1, j<=n, j++, summ=summ + U[[i,j]]*X[[j]]] > ] > When I try to print i or j, nothing shows up. > Can anyone please help? > > Thank you in advance, > Jamie