# What is the relationship between a list of symbols created by a specific name, and a expression with such a name?

I'm trying to create a list of symbols called "x" for calculating symbolic gradients of some functions, so I write:

x = Table[Symbol["x"][i], {i, 1, 3}]


why it complains \$RecursionLimit: Recursion depth of 1024 exceeded?

When I change the expression name from x to a, it works

a = Table[Symbol["x"][i], {i, 1, 3}]


Outputs

{x, x, x}


I knew c++ and python, but feel really hard to understand what happened when I type these symbol creation sentences in mathematica.

• Welcome to Mathematica StackExchange! I would suggest reading this Fast Introduction to Wolfram Language for programmers. It also has special notes for people coming from Java/Python background. I think this will be useful for you to grasp some basic differences and peculiarities of Mathematica. Apr 20 at 9:53
• Welcome to the Mathematica Stack Exchange. The introductory book written by the inventor is a good learning resource. There is a fast intro for math students as well as a fast intro for programmers to choose from.
– Syed
Apr 21 at 4:16
• Many thanks Domen and Syed. I didn't manage to find these precesie resource instead of the offical documents. I will now go to learn them and evaluate my problem again. Apr 22 at 6:11

The evaluator will evaluate an expression until nothing changes any more. Consider some code that gives a recursion:

x = Table[Symbol["x"][i], {i, 1, 2}]


To begin, the right side is evaluated and gives "x" the value:

{x,x}


"x" has now the value {x1,x}. This contains the symbol "x". Therefore this is again evaluated to:

{{x1,x}1,{x1,x}}

We can simulate this by giving different names to each new value of x:

x1 = Table[Symbol["x"][i], {i, 1, 2}]
x2 = Table[Symbol["x1"][i], {i, 1, 2}]
x3 = Table[Symbol["x2"][i], {i, 1, 2}] On the other hand, the following does not create a recursion because after one step the evaluation stops because "x" has no value:

a = Table[Symbol["x"][i], {i, 1, 2}]