Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*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 2003

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

Search the Archive

Re: Simple List question. HELP.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39400] Re: Simple List question. HELP.
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 14 Feb 2003 03:18:06 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <b2fr48$kak$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

you can assign parts only to parts that exist, i.e.,
lst=Table[0,{4}]

lst[[1]]={0,1};
lst[[2]]={1,2};

work as expected.

Regards
  Jens


Daniel Heneghan wrote:
> 
> I am new to Mathematica. This is vexing. All I want to do is create a
> 2-dimensional list so that I can enter x,y values and then plot the
> list. I want to do this programmatically. I am having such incredible
> trouble trying to accomplish this simple task. I know that there is
> probably a Mathematica optimized way to do this, but I and trying to
> write a little program and for now I want to stay with paradigms that I
> am familiar with. Here is what I have been doing.
> 
> Create a 2 dimensional list.
> In[532]     lst={{}}
> Out[532]=    {{}}
> 
> Enter the first pair into the first place in the list.
> In[533]:= lst[1]={{0,1}}
> 
> Errors and beeps here, but it does seem to record the correct values.
> Set::write: Tag List in {{}}[1] is Protected.
> Out[533]={{0,1}}
> 
> Add anoter pair of values.
> 
> In[534]:= lst=Append[lst,{{1,2}}]
> Out[534]= {{},{{1,2}}}
> The second pair is OK, but the first pair has been obliterated.
> 
> Add another pair. Now all subsequent entries are OK, but I still have
> lost the first pair.
> In[535]:= lst=Append[lst,{{2,c}}]
> Out[535]= {{},{{1,2}},{{2,c}}}--
> 
> What is going on? What are the mysteries of working with lists in
> Mathematica. In any programming language this is simple. I can't grasp
> it in Mathematica. The reason I need to do this is that for the list
> plot I need the x values to start at 0 not 1.
> 
> Thanks,
> 
> Daniel Heneghan
> Ceara Systems
> (212) 696-9208
> ceara at bway.net


  • Prev by Date: Re: Re: Limits: Is there something I'm missing Here?
  • Next by Date: Porting Mathematica graphics to MicroSoft Point, with quality
  • Previous by thread: Re: Simple List question. HELP.
  • Next by thread: Re: Simple List question. HELP.