MathGroup Archive 2010

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

Search the Archive

Re: Question


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


  • Prev by Date: using rules for square roots
  • Next by Date: Re: Nonlinear Least Squares lsqnonlin
  • Previous by thread: Re: Question
  • Next by thread: Re: Question