Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

Subscript[r, i] = 3

3

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

r = 6

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 has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
#5 here is relevant –  ssch Oct 15 '13 at 13:58
1  
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. –  Jeremy Oct 16 '13 at 14:32
add comment

Browse other questions tagged or ask your own question.