MathGroup Archive 2006

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

Search the Archive

Re: Trouble with tables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64835] Re: [mg64822] Trouble with tables
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sun, 5 Mar 2006 03:18:54 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

t1=Table[{x[1,1],x[1,2],y},{x[1,1],1,3},{x[1,2],1,3}];

ni=1;nj=2;
a=Flatten[Table[x[i,j],{i,1,ni},{j,1,nj}]];
t2=Table[Append[a,y],Evaluate[Sequence@@Thread[{a,1,3}]]];

t1==t2

True


Bob Hanlon

> 
> From: Luiz Melo <luiz.melo at polymtl.ca>
To: mathgroup at smc.vnet.net
> Subject: [mg64835] [mg64822] Trouble with tables
> 
> Hi there,
> I'm having a little trouble with the function "Table". Using:
> 
> t1 = Table[{x[1, 1], x[1, 2], y}, {x[1, 1], 1, 3}, {x[1, 2], 1, 3}]
> 
> the variables x[1,1] and x[1,2] assume the values 1, 2 and 3, that's fine.
> Now I want to automatically generate the argument of the function Table 
above
> and then evaluate it. I tried the following program:
> 
> ni = 1; nj = 2;
> a = Flatten[Table[x[i, j], {i, 1, ni}, {j, 1, nj}]]; d = Dimensions[a][[1]];
> b = {}; Do[b = Append[b, {a[[i]], 1, 3}], {i, 1, d}];
> t2 = Table[Join[{Append[a, y]}, b]];
> 
> and I got a result (t2) which is different from t1. Why?
> 
> Thanks,
> Luiz
> 
> 
> 
> 


  • Prev by Date: Re: Mathematica, PDF and Ghostscript
  • Next by Date: Re: Unprotecting "I"
  • Previous by thread: Trouble with tables
  • Next by thread: Re: Trouble with tables