MathGroup Archive 2008

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

Search the Archive

Re: Symbol function, a question

  • To: mathgroup at
  • Subject: [mg90515] Re: Symbol function, a question
  • From: Bill Rowe <readnews at>
  • Date: Fri, 11 Jul 2008 02:05:21 -0400 (EDT)

On 7/10/08 at 6:37 AM, tunganhtr at (tung tran) wrote:

>Hi everybody, I have a question needing your help. Firstly, I create
>a variable x95 = 100 Now, I want to change the value of my variable
>x95 to 20 , so I want to use some procedure like :

>Symbol["x" <> ToString[95]] = 20 my idea is to make Mathematica
>write the term "x95" automatically for me but when I use the Symbol
>function in this case, it gives me automatically 100 and I don' t
>know how to call only x95. Thank you if someone can give me a

It isn't entirely obvious to me what you want to do. Clearly, if
you created x95 by typing


in a new cell, the simplest way to set this variable to 100
would be to type


in a new cell. Possibly you are trying to create several
variables programatically, assign values to the variables you
created then assign new values at a later time. That is
something along the lines of:

In[1]:= vars = Table[ToExpression["x" <> ToString[n]], {n, 5}]

Out[1]= {x1,x2,x3,x4,x5}

In[2]:= vars = RandomInteger[100, {5}]

Out[2]= {47,39,67,61,63}

In[3]:= Clear[vars]

In[4]:= vars = Range[5]

Out[4]= {1,2,3,4,5}

  • Prev by Date: Re: Import/Export Problem
  • Next by Date: Re: Almost symbolic computations (?)
  • Previous by thread: Re: Symbol function, a question
  • Next by thread: Re: Symbol function, a question