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.

  • 2
    $\begingroup$ Please give a couple of lines of code where this happens for you. Then we can see if the same happens for us. $\endgroup$ – Kiro Jan 3 '19 at 9:57

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.