Re: lists of variables

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

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? In[1]:= Table[ToExpression[StringJoin["t", ToString[i]]], {i, 10}] Out[1]= {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, /J.M.