1
$\begingroup$

this is probably a dumb question (Mathematica noob here) but I can't figure out what's going on. I have a variable that I assign a value to and use, then later in the notebook I assign it a different value and reuse it for a similar calculation, and now I want to clear its value and just have it act as a variable. However I get this:

Strange Mathematica variable behavior

As you can hopefully see in the image, I am unable to clear the variable w_i, however when I ask the value of the variable it tells me what I previously assigned to it (w_p and w_s are also symbols). Also note that the coloration of the variable indicates that it is undefined, including when I explicitly define it above to the value listed here, and when I assigned it a test value in the image. It should have turned from blue to black when I evaluated that cell. Are there some fancy commands that I can use to figure out what is going on with w_i?

I realize that I could and probably should be using a Module[] block for namespace handling since I use the same variable name in multiple places, it just peeves me that Mathematica has so many little quirks like this.

$\endgroup$
1
  • 12
    $\begingroup$ Subscripted variables are not symbols unless you Symbolize them after loading the Notation package. Look up the help on that package. Generally subscripted variables are not a good idea in Mathematica. While Clear does not work, you can remove an assignment with $\omega _i=.$ $\endgroup$
    – Bill Watts
    Commented Oct 21, 2020 at 17:52

0

Browse other questions tagged or ask your own question.