1
$\begingroup$

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?

$\endgroup$
5
  • 1
    $\begingroup$ #5 here is relevant $\endgroup$
    – ssch
    Oct 15, 2013 at 13:58
  • 1
    $\begingroup$ very similar (duplicate?) $\endgroup$
    – gpap
    Oct 15, 2013 at 14:00
  • $\begingroup$ Please read the documentation for Notations and Symbolize $\endgroup$ Oct 15, 2013 at 21:20
  • $\begingroup$ This pitfall discussion is also relevant. $\endgroup$
    – m_goldberg
    Oct 16, 2013 at 7:56
  • $\begingroup$ 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. $\endgroup$
    – jlconlin
    Oct 16, 2013 at 14:32

0

Browse other questions tagged or ask your own question.