MathGroup Archive 2002

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

Search the Archive

Re: more elements in a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32310] Re: [mg32293] more elements in a list
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Sat, 12 Jan 2002 05:18:30 -0500 (EST)
  • References: <200201110935.EAA02945@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I think you should have tried your suggestion first on a machine with
Mathematica. It doesn't work as it is.

In[4]:=
x = {a, b, c}; n = {2, 5, 4};
  Flatten[MapThread[Table, {x, n}, 1]]
Table::itform: Argument 2 at position 2 does not have the correct form for
an \
iterator.
Table::itform: Argument 5 at position 2 does not have the correct form for
an \
iterator.
Table::itform: Argument 4 at position 2 does not have the correct form for
an \
iterator.
General::stop: Further output of Table::itform will be suppressed during
this \
calculation.
Out[5]=
{Table[a,2],Table[b,5],Table[c,4]}

The idea is pretty good, however, but you should write each element of n
inside curly brackets:

In[11]:=
x = {a, b, c}; n = {2, 5, 4};
Flatten[MapThread[Table, {x, List /@ n}, 1]]
Out[12]=
{a, a, b, b, b, b, b, c, c, c, c}

Tomas Garza
Mexico City

----- Original Message -----
From: "Juan" <erfa11 at hotmail.com>
To: mathgroup at smc.vnet.net
Subject: [mg32310] [mg32293] more elements in a list


> Hi, Merkat
> I think this is O.K (I don´t have Mathematica in this computer).
>
> x={a,b,c);n=(2,5,4);
> MapThread[Table,{x,n},1]//Flatten
>
> Best regards
> Juan
>
> _________________________________________________________________
> Hable con sus amigos en línea, pruebe MSN Messenger:
http://messenger.msn.es
>
>



  • Prev by Date: Graphics with column
  • Next by Date: Re: Interpolation
  • Previous by thread: more elements in a list
  • Next by thread: Re: more elements in a list