Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Nonatomic expression ? in Append command

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32846] Re: [mg32832] Nonatomic expression ? in Append command
  • From: BobHanlon at aol.com
  • Date: Fri, 15 Feb 2002 02:49:46 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 2/14/02 4:09:03 AM, tmakino at spectro.ujf-grenoble.fr writes:

>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)ÅuAppend::"normal": "Nonatomic expression expected at position 1
> in Append[omegaAlist, 0.007]."Åv
> 
> (2)Åu$RecursionLimit::"reclim": "Recursion depth of \!\(256
> \) exceeded."Åv
> 
> 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];
>

Clear[et1,omegaAlist];

Since you cleared omegaAlist, it is just a Symbol (atomic) 
and not a List to which elements can be appended.  
You need to initialize it to an empty list.

For[omegaAlist={}; r=0, r<=3, r++ ,
 
    et1=3.444+r*0.001;
 
    omegaAlist=Append[omegaAlist, et1]];
omegaAlist=Delete[omegaAlist, 1]

{3.445, 3.446, 3.447}

Another approach would be

omegaAlist=Table[3.444+r*0.001, {r, 3}]

{3.445, 3.446, 3.447}


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Numerical derivatives of compiled functions
  • Next by Date: Partitions
  • Previous by thread: Re: Nonatomic expression ? in Append command
  • Next by thread: Re: Nonatomic expression ? in Append command