Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Array vs Table' topicStudent Support Forum > General > "Array vs Table"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
yehuda
11/18/12 5:46pm

Array uses functional programming notation to generate the elements
So
Array[mat,50] expect mat to be a function of a single argument. if it is not defined, than it is just a head, since Mathematica is also symbolic language

example
Array[mat,10]
returns
{mat[1],mat[2],...,mat[10]}

however
mat1[x_]:=x^2
Array[mat1,5]
returns
{1,4,9,16,25}
The same as
Array[#^2&,5]
or
Array[Function[x,x^2],5]

As for timings, Table is usually faster, but has the benefit of a shorter syntax form and allows offsets for the indexes

one last comment is that usually there is no need to "prepare in advance" indexed functions or "variables"

HTH
yehuda

URL: ,

Subject (listing for 'Array vs Table')
Author Date Posted
Array vs Table Tom Mozdzen 11/16/12 10:40am
Re: Array vs Table yehuda 11/18/12 5:46pm
Re: Re: Array vs Table Tom Mozdzen 11/19/12 10:44am
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic