Re: Re: Newbie question: Which is more versatile, Table[] or Array[]?
- To: mathgroup at smc.vnet.net
- Subject: [mg94156] Re: [mg94150] Re: Newbie question: Which is more versatile, Table[] or Array[]?
- From: "Sseziwa Mukasa" <mukasa at jeol.com>
- Date: Sat, 6 Dec 2008 06:13:29 -0500 (EST)
- References: <ghb034$oii$1@smc.vnet.net> <200812051205.HAA28385@smc.vnet.net>
----- Original Message -----
From: "magma" <maderri2 at gmail.com>
To: <mathgroup at smc.vnet.net>
Sent: Friday, December 05, 2008 7:05 AM
Subject: [mg94156] [mg94150] Re: Newbie question: Which is more versatile, Table[] or
Array[]?
> On Dec 5, 11:34 am, stpatryck <stpatr... at gmail.com> wrote:
>> I'm reading the Schaum's Outline for Mathematica and am in the chapter
>> concerning list manipulation. So far, the only difference I can tell
>> between the Array[] and Table[] commands is that with Table, you use
>> an expression as the first parameter/argument and with Array, you use
>> a function. The other parameters, of course, are tailored differently
>> because they support the first parameter i.e. expression or function.
>>
>> Anyone know of any significant difference between these two commands
The starting points of Table commands can depend on the other loop variables
eg.
Table[{i,j},{i,10},{j,i,10}]
This is useful for structures that aren't arrays but can be indexed.
>> other than syntax? Please feel free to e-mail me at
>> stpatr... at gmail.com.
>>
>> Thanks,
>> Patrick
>
> There is of course a certain overlap between Array and Table, but
> table is more general and powerful.
> This means that anything you can do with Array can be done with Table
> too, but not vice versa (in an easy way).
> Strtictly speaking I think the 2 commands are indeed equivalent, but
> in some cases Table is clearly the best choice.
>
>
> For example look at the documentation for Table/relations to other
> functions
>
> Array[#1^#2 &, {3, 4}]
>
> can easily be translated into
>
> Table[x^y, {x, 3}, {y, 4}]
>
> But Array has a limitation: the index (or indices) are always
> integers, while with Table the index can step through a list of
> symbols as in
>
> Table[f[c], {c, {red, green, blue}}]
>
> This could be done with Array and some helper functions too, but not
> easily.
>
> When you have indices that take integer values, they are essentially
> equivalent.
>
> hth
>
- References:
- Re: Newbie question: Which is more versatile, Table[] or Array[]?
- From: magma <maderri2@gmail.com>
- Re: Newbie question: Which is more versatile, Table[] or Array[]?