Re: filling in an array

*To*: mathgroup at smc.vnet.net*Subject*: [mg55356] Re: filling in an array*From*: Peter Pein <petsie at arcor.de>*Date*: Sun, 20 Mar 2005 04:11:48 -0500 (EST)*References*: <d1guie$sc$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

dumb_founded wrote: > How can I input values into an array most efficiently? I tried the > code below, but it doesn't work. The kernel starts working through the > loop and never gets out. > > Array[b, 10]; > For[i = 1, i = 10, b[i] = i/10] > 1. If nothing else helps, look at the documetation: For[start, test, incr, body] executes start, then repeatedly evaluates body and incr until test fails to give True. 2. to compare the values of two expressions use ==, not = 3. Had a look at the result of Array[b,10]?? Do so. 4. To address the elemnts of a List use b[[i]] not b[i] 5. Just guessing: b=Array[1/#&,10] or For[b=Table[,{10}]; i=1, i<=10, i++, b[[i]]=1/i]; ?? -- Peter Pein Berlin