MathGroup Archive 2006

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

Search the Archive

Re: decrementing problem

  • To: mathgroup at
  • Subject: [mg72311] Re: decrementing problem
  • From: "Roman" <rschmied at>
  • Date: Tue, 26 Dec 2006 05:02:15 -0500 (EST)
  • References: <em60nv$3ar$>

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

Try with the condition "i >= 1" instead.

jltrahan at 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

  • Prev by Date: Re: Using Mathematica to solve Smullyan "Scheherazade" puzzle?
  • Next by Date: Re: decrementing problem
  • Previous by thread: Re: decrementing problem
  • Next by thread: Re: decrementing problem