Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: lists of variables

  • To: mathgroup at
  • Subject: [mg58176] Re: lists of variables
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at>
  • Date: Tue, 21 Jun 2005 06:02:50 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, England
  • References: <d9630u$q1t$>
  • Sender: owner-wri-mathgroup at

Heath Gerhardt wrote:
> I need to make lists of variables, for example
> {t1,t2,t3}
> but have not been able to figure out how to make Mathematica do this. 
> Tried using
> Array[t,3]
> which gives
> {t[1],t[2],t[3]}
> but then I don't know how to set the t[i]'s in expressions similar to
> F[t[1]_,t[2]_,t[3]_]:=Cos[t[1]+t[2]-t[3]]
> thanks in advance
> Heath

Is this what you are looking for?

Table[ToExpression[StringJoin["t", ToString[i]]],
   {i, 10}]

{t1, t2, t3, t4, t5, t6, t7, t8, t9, t10}

We concatenate two strings (having transformed first the integer value 
of 'i' into a string), then we convert the resulting string into a 
symbol (strings and symbols behave differently in Mathematica even if 
sometimes they looks alike on the frontend).

Hope this helps,

  • Prev by Date: General 3-state stochastic matrix
  • Next by Date: Re: associative arrays
  • Previous by thread: Re: lists of variables
  • Next by thread: Re: lists of variables