Re: Question
- To: mathgroup at smc.vnet.net
- Subject: [mg110245] Re: Question
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 10 Jun 2010 08:07:54 -0400 (EDT)
On 6/9/10 at 7:19 AM, dclengacher at gmail.com (David Lengacher) wrote:
>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.
Here are two ways to do what you want
vars=Table[ToExpression["x"<>ToString@n],{n,10}]
vars=ToExpression["x"<>ToString[#]&/@Range[10]]