MathGroup Archive 2005

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

Search the Archive

basic issue with do and :=


Hi all,

this works as (I) expected

-------------------------
Do[a[i] = i, {i, 10}]
Do[b[i] =a[i]+1, {i, 10}]
-------------------------

While this doesn't:

--------------------------
Do[a[i] = i, {i, 10}]
Do[b[i] :=a[i]+1, {i, 10}]
---------------------------

[note ":=" instead of "=" on the second line].

namely the output is: "b[2]:=a[i]+1" for all i



Is there any compact way to define: "b[i] :=a[i]+1" for all i ?


Thank you in advance,

David


  • Prev by Date: Re: Nesting NMaximize
  • Next by Date: Bug in Reduce?
  • Previous by thread: Re: Nesting NMaximize
  • Next by thread: Re: basic issue with do and :=