Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I like to give subscripts to my variable names when the variables are related. I.e.,

Subscript[r, i] = 3


A problem arises when I later assign r to a value and want to use Subscript[r,i] again.

r = 6


Subscript[r, i]

Subscript[6, i]

Is there any way for me to get the value I assigned to Subscript[r,i]? Is this the wrong way to use Mathematica?

share|improve this question

marked as duplicate by Yves Klett, Sjoerd C. de Vries, Michael E2, Mike Honeychurch, István Zachar Oct 16 '13 at 7:57

This question was marked as an exact duplicate of an existing question.

#5 here is relevant – ssch Oct 15 '13 at 13:58
very similar (duplicate?) – gpap Oct 15 '13 at 14:00
Please read the documentation for Notations and Symbolize – Mike Honeychurch Oct 15 '13 at 21:20
This pitfall discussion is also relevant. – m_goldberg Oct 16 '13 at 7:56
Thanks all for your comments. I'll try to avoid doing this in the future. Unfortunately, this is why I use Mathematica. If I can't do this, then I'll most likely stick with another language. – jlconlin Oct 16 '13 at 14:32