MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: decrementing problem


On Dec 18, 2006, at 6:56 AM, 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

My newbie thinking is that your test in the first For loop is  
evaluating to False right away.

  i<=1

In the first step i is 4.  The question is if 4 is less than or equal  
to 1.  That is False right away, so that loop ends and does not enter  
into the second loop at all.

With the best,

János


  • Prev by Date: Re: decrementing problem
  • Next by Date: a bug in recursive formula in 64 bit machine
  • Previous by thread: Re: decrementing problem
  • Next by thread: Re: decrementing problem