Re: Nonatomic expression ? in Append command
- To: mathgroup at smc.vnet.net
- Subject: [mg32849] Re: Nonatomic expression ? in Append command
- From: "Avraham Shinnar" <as1619 at columbia.edu>
- Date: Fri, 15 Feb 2002 02:49:51 -0500 (EST)
- Organization: Columbia University
- References: <a4fo5k$j55$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
you are missing some puctuation. Also, you need to first initialize
omegaAlist to an empty list:
Clear[et1, omegaAlist];
omegaAlist = {};
For[r = 0, r <= 1, r++,
et1 = 3.444 + r*0.001;
omegaAlist = Append[omegaAlist, N[et1]];
]
Print[omegaAlist];
omegaAlist = Delete[omegaAlist, 1];
However, a much better approach is to use list-based programming:
omegaAlist = 3.444 + # 0.001 & /@ Range[0, 1]
This approafch allows you to make changes to basically the same variables as
in your For loop. A less general way, would be:
omegaAlist = NestList[# + .001 &, 3.444, 1]
-- Avraham
"Takayuki MAKINO" <tmakino at spectro.ujf-grenoble.fr> wrote in message
news:a4fo5k$j55$1 at smc.vnet.net...
> bonjour
>
> I am very happy to meet you all. My name is Takayuki. It is my great
> pleasure to know the existense of such beautiful community. I would like
> to perform the loop calculation by writing the following code in
> Mathematica. Then, the result of calculation should be stored in some
> lists, assuming the name of list is "omegaAlist". If one performs that
> code, the error message will be output. The contents of which is the
> following:
>
> (1)「Append::"normal": "Nonatomic expression expected at position 1
> in Append[omegaAlist, 0.007]."」
>
> (2)「$RecursionLimit::"reclim": "Recursion depth of \!\(256
> \) exceeded."」
>
> I do not know how to work around this problem. Please help me to
> eliminate this obstacle, if there are experts who are familiar with
> these kinds of things.!!!
>
> ------------------------------------------------
>
> Clear[et1,omegaAlist]
> For[r =0, r <= 1, r++
>
> et1 = 3.444 + r*0.001
>
> omegaAlist = Append[omegaAlist, N[et1]];
> ]
> omegaAlist = Delete[omegaAlist, 1];
>
>