4
$\begingroup$

I want Mathematica to interpret subscripted variables as symbols. I found documentation suggesting the Notation package could do this, but if I do:

Needs["Notation`"]
Symbolize[ParsedBoxWrapper[SubscriptBox["_", "_"]]]
x = 1
Subscript[x, 1]

I still get:

1
Subscript[1, 1]

Am I doing anything wrong?

$\endgroup$
5
$\begingroup$

In order to be recognised as symbols the subscripted forms need to be keyed in control-_, you cannot explicitly use Subscript:

enter image description here

When you use Subscript[] the arguments are replaced by their values before being passed to the function, but if you do x Ctrl+_ 1 the Notation package can grab it before the replacement.

$\endgroup$
  • 1
    $\begingroup$ Ok I got it. In case you know how to tell subscript not to replace it's arguments by their values, I'd be still interested. $\endgroup$ – PeMa Sep 9 '14 at 22:52
  • $\begingroup$ @PeMa You could SetAttributes HoldFirst or HoldAll for Subscript reference.wolfram.com/language/ref/HoldFirst.html $\endgroup$ – MaTECmatica Sep 10 '14 at 4:25
  • $\begingroup$ Well that's not gonna work I think. If I have e.g. phi and phi_L I don't want phi not to be evaluated, but of course not inside phi_L. $\endgroup$ – PeMa Sep 10 '14 at 12:32
  • $\begingroup$ Just checked: SetAttributes[Subscript, HoldAll] indeed prevents the value substitution, but the result still is not recognized as a symbol that can for example be used in the function definition pattern. $\endgroup$ – george2079 Sep 10 '14 at 15:15

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.