Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*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 2006

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

Search the Archive

Re: Array

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69245] Re: [mg69220] Array
  • From: "Adriano Pascoletti" <pascolet at dimi.uniud.it>
  • Date: Sun, 3 Sep 2006 23:46:30 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Bruce Colletti wrote ..
> The command:
> 
>    {A[1], A[2], A[3]} = {1, 2, 3}
> 
> assigns a value to each A-variable.  However, the command:
> 
>    Array[A,3] = {1,2,3}
> 
> generates an error message.
> 
> What is the difference between the two lines?
> 
> Thankx.
> 
> Bruce
> 

Array[A,3] is the list {A[1],A[2],A[3]} only after evaluation so

In[2]:=
Evaluate[Array[A, 3]] = {1, 2, 3}

Out[2]=
{1, 2, 3}

does what you want:

In[3]:=
DownValues[A]

Out[3]=
{HoldPattern[A[1]] :> 1, HoldPattern[A[2]] :> 2, 
  HoldPattern[A[3]] :> 3}

Adriano Pascoletti


  • Prev by Date: RE: Array
  • Next by Date: Co-Displaying Combinatorica and Graphics Objects
  • Previous by thread: RE: Array
  • Next by thread: Re: Array