Re: decrementing problem

*To*: mathgroup at smc.vnet.net*Subject*: [mg72309] Re: decrementing problem*From*: "Philipp" <Philipp.M.O at gmail.com>*Date*: Tue, 26 Dec 2006 04:54:11 -0500 (EST)*References*: <em60nv$3ar$1@smc.vnet.net>

For the first For loop to work n needs to be less or equal to 2 (n <= 2). Even then the loop becomes infinite, which, I am sure, was not your intention. Besides getting your conditions for indices right, you should also revise where you put the summ=0 statement; as it is now, the summ is set to 0 before every inside For. Cheers, Philipp. 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