So I'm the situation of needing analytical solutions to a family of equations of the form Ax=b, where A is an nxn matrix. I've written a function that does what I want, but I'm currently using a bit of a hack to generate arbitrary (dummy) variable names for the n-vector 'x' :

Can be used as valid variables too. In any case you should watch out that your variables are not assigned to values accidently. This is a common source of errors if you use them in combination with Solve or its friends.

Why did I use x= in the first example and vars= in the second one?

Let's take a very simple example

a = b[1];
OwnValues[a]
(*
{HoldPattern[a] :> b[1]}
*)

and now we assume that the b would be an a, than we would get an OwnValue-rule like

HoldPattern[a] :> a[1]

Therefore, the moment you use a an substitution process starts which is only stopped by the $RecursionLimit, because a is evaluated into a[1] which again contains an a in the front. This is repeatedly replaced.

Therefore, if you want to use the second approach, don't call it like x = Table[x[i], {i, 10}].

Evaluate x={x[1], x[2], x[3], x[4], x[5]}. In MMA 8.0.4 it exceeds the recursion limit. A bug? Whatever, it makes indexed variables a problem if used in the way the OP wants to use them.
–
m_goldbergOct 17 '12 at 6:45

1

@m_goldberg No, no bug, it is the expected behavior. I added an explanation and made clear how to use it. Thank you for pointing it out.
–
halirutanOct 17 '12 at 9:27

Here is a function that will do what you asked when it is passed a symbol and the length of the vector. The function returns the list of symbols it constructs; it assures that all the symbols in the list are clear of values.

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.