MathGroup Archive 2005

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

Search the Archive

Re: Re: lists of variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58270] Re: Re: lists of variables
  • From: Andrzej Kozlowski <andrzej at akikoz.net>
  • Date: Sat, 25 Jun 2005 01:56:28 -0400 (EDT)
  • References: <d9630u$q1t$1@smc.vnet.net><d9e10o$ge4$1@smc.vnet.net> <200506240650.CAA29458@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 24 Jun 2005, at 15:50, Ray Koopman wrote:

>
> dh wrote:
>
>> Hi Heath,
>> You already got many answers, but I think the solution to create
>> a variable name as a string and using ToExpression  is not the
>> appropriate way to do this.
>> Array[..] is made for this purpose.
>>
>
> I agree that using ToExpression to construct code is awkward and tends
> to obscure what the code is, but for functions such as Minimize, that
> require names of variables in their calling sequence, how else would
> you handle problems in which the number of variables is not fixed?
>

If all you want  a list f variable length of symbols named in  
cunsecutive order and if you do not mind that the names may be  
different each time you run your program another possibility is to  
use something like:

In[2]:=
vars = Unique /@ Table[t, {5}]

Out[2]=
{t$22, t$23, t$24, t$25, t$26}

Andrzej Kozlowski

Chiba, Japan


  • Prev by Date: Re: a question about plot a list of functions.
  • Next by Date: Spline
  • Previous by thread: Re: lists of variables
  • Next by thread: lists of variables