Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

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


  • 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