Re: Answer
- To: mathgroup at smc.vnet.net
- Subject: [mg110409] Re: Answer
- From: Srikanth K S <sriperso at gmail.com>
- Date: Wed, 16 Jun 2010 05:42:53 -0400 (EDT)
*Dear Steve, Subscript[q, #] & /@ Range[10] Seems simple to me! Further if you wanted to generate a matrix, Table[Subscript[q, i, j], {i, 1, 3}, {j, 1, 4}] gives {{Subscript[q, 1, 1], Subscript[q, 1, 2], Subscript[q, 1, 3], Subscript[q, 1, 4]}, {Subscript[q, 2, 1], Subscript[q, 2, 2], Subscript[q, 2, 3], Subscript[q, 2, 4]}, {Subscript[q, 3, 1], Subscript[q, 3, 2], Subscript[q, 3, 3], Subscript[q, 3, 4]}} *--- 2010/6/10 S. B. Gray <stevebg at roadrunner.com> > 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[ ]. > >