MathGroup Archive 2010

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

Search the Archive

Answer


How can you create a set of variables: x1 to xn  using the Table, or some
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


One easy was is for example ta = Table[Subscript[q, j], {j, 10}].
This gives you 10 subscripted variables. Then you can do the usual 
operations such as Subscript[q,5]=7 . Then ta is

{Subscript[q, 1], Subscript[q, 2], Subscript[q, 3], Subscript[q, 4], \
7, Subscript[q, 6], Subscript[q, 7], Subscript[q, 8], Subscript[q, \
9], Subscript[q, 10]}

It is easier to bring up the Basic Math palette and use it to make the 
subscripts rather than using Subscript[ ].


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