Re: Question
- To: mathgroup at smc.vnet.net
- Subject: [mg110260] Re: Question
- From: Simon <simonjtyler at gmail.com>
- Date: Thu, 10 Jun 2010 08:10:38 -0400 (EDT)
- References: <huntc8$bka$1@smc.vnet.net>
On Jun 9, 7:19 pm, David Lengacher <dclengac... at gmail.com> wrote:
> How can you create a set of variables: x1 to xn using the Table, or so me
> similar function? I need a large list of variables to use in a linear
> program and so far have to type them out manually.
>
> David
Hi David,
Here's a simple example pulled from the documentation center:
Table[Symbol["x" <> ToString[i]], {i, 5}]
{x1, x2, x3, x4, x5}
Of course you could also use Table[x[i],{i,1,5}] or
Table[Subscript[x,i],{i,1,5}], they all have advantages and
disadvantages.
Simon