When normal variables are stored in the kernel after an evaluation they change color in the notebook from blue to black. I notice that if such variables are defined with symbols having subscripts such variables are kept blue, so it is hard to tell if they have been evaluated and stored in the kernel or not. Why is it so? I tried figuring out if there is a duplicate of this question, but I haven't found anything.
1 Answer
The reason is that Subscript
does not work as you expect (a very good reason not to use it): For example Subscript[a,1] = 2
stores the value 2
as downvalue in the symbol Subscript
(DownValues@Subscript
) not as an upvalue in the symbol a
.
This can be cured by TagSet
(e.g., a /: Subscipt[a, 1] = 2
) but I strongly advise to avoid Subscript
and to simply write a[1] = 2
so that the 2
is stored as downvalue of a
; this enforces a
to have a definition so that the symbol is rendered in black from now on.