MathGroup Archive 2005

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

Search the Archive

Re: lists of variables

  • To: mathgroup at
  • Subject: [mg58185] Re: lists of variables
  • From: Bill Rowe <readnewsciv at>
  • Date: Tue, 21 Jun 2005 06:03:16 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

On 6/20/05 at 5:21 AM, heathgerhardt at (Heath Gerhardt)

>I need to make lists of variables, for example


>but have not been able to figure out how to make Mathematica do
>this. Tried using

You can create these variables as follows:



>which gives


Which would be a list containing the function t to be evaluated at 1,2 and 3.

>but then I don't know how to set the t[i]'s in expressions similar


It isn't entirely clear from this what you want to do. I am going to assume what you are trying to do is set the variables you want created to specific values.

Here is an example

varList = (ToExpression["t"<>ToString@#]&/@Range[3]; 
Evaluate[varList] =  Range[6, 8]; 


Note, this example assumes the variables t1,t2 and t3 do not have assigned values. If they did, this example will not work. This is because Mathematica will evaluate each of the variables and attempt to set the result of that evaluation to the values on the right hand side. Clearly, this isn't possible when t1 has been set to say 1.
To reply via email subtract one hundred and four

  • Prev by Date: Re: associative arrays
  • Next by Date: Re: field line with NDSolve - attachment on www
  • Previous by thread: Re: lists of variables
  • Next by thread: Re: lists of variables