Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Leading zero being added to lists, can't get it to go away.' topicStudent Support Forum > General > Archives > "Leading zero being added to lists, can't get it to go away."

Next Comment >Help | Reply To Topic
Author Comment/Response
Garth
03/22/00 06:07am

When I enter this into Mathematica 4.0:

f[x_]:=x^2;
list=Range[9];
For[i=0,i<=9,i++,list[[i]]=f[i]];
list

I would expect the output to be a nice simple list that would look like this:
[1,4,9,16,25,36,49,64,81]

but instead, it the result is this:
0[1,4,9,16,25,36,49,64,81]

Mathematica for some reason adds in a leading zero to the list, and I am at a
loss why it is added...

Can anybody tell me why this zero is added? Or better yet, how can i get rid of
it?

Thanks,
Garth

URL: ,

Subject (listing for 'Leading zero being added to lists, can't get it to go away.')
Author Date Posted
Leading zero being added to lists, can't get it... Garth 03/22/00 06:07am
Re: Leading zero being added to lists, can't ge... Forum Modera... 03/22/00 06:09am
Next Comment >Help | Reply To Topic