MathGroup Archive 2010

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

Search the Archive

Re: Question


On Jun 9, 6:19 am, 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

I think what you want is Unique[]:

In[1]:= Unique["x"]

Out[1]= x1

You can use the Table[] command to generate x number of unique
variables, say:

In[2]:= Table[Unique["x"], {10}]

Out[2]= {x2, x3, x4, x5, x6, x7, x8, x9, x10, x11}

(And note that the generated variables are in fact unique.)

-RG


  • Prev by Date: Re: Nonlinear Least Squares lsqnonlin
  • Next by Date: O'Reilly Ebook Deal of Day: Mathematica Cookbook ($9.99)
  • Previous by thread: Re: Question
  • Next by thread: Re: Question