I can do


to create a symbol foobar. How to create a symbol $\theta_1$?

Symbol[Subscript[\[Theta], 1]]

doesn't work.

  • 1
    $\begingroup$ Subscript[\[Theta], 1] = 20 works. $\endgroup$
    – dearN
    Commented Oct 27, 2012 at 17:27
  • $\begingroup$ I know; Do this fact help answer the question? Or do you mean define the symbol by assigning a value? How to create the symbol without having to assign it an arbitrary value at the same time? $\endgroup$
    – user13253
    Commented Oct 27, 2012 at 17:34
  • $\begingroup$ I could create a symbol without assigning a value to it with Subscript[\[Theta], 1]. Beyond that I am unsure what you want to do with the symbol. $\endgroup$
    – dearN
    Commented Oct 27, 2012 at 17:40
  • 3
    $\begingroup$ Have you seen this?: mathematica.stackexchange.com/questions/1004/… $\endgroup$
    – DavidC
    Commented Oct 27, 2012 at 17:44
  • 1
    $\begingroup$ How about the Notation package? $\endgroup$ Commented Oct 27, 2012 at 18:23

1 Answer 1


Although your question is stated clear, I'm still wondering whether you understood, that Subscript[\[Theta], 1] is not a symbol. It's a box-structure! Therefore, what you do when you assign it a value like

Mathematica graphics

is, that you don't assign a value to some indexed variable x. No, you assign a value (a DownValue) to Subscript

Mathematica graphics

Let's assume I can guess that you like to use some indexed variable in your code then you should consider to work with the Notation package as already pointed out in the comments.

You can, after loading the Notation package, define a symbol like pattern which you want to use for a indexed variable. So for instance

Mathematica graphics

Note, that the parameter is x subscript Blank[]!

Symbolize[ParsedBoxWrapper[SubscriptBox["x", "_"]]]

If you now look at InputForm[Subscript[x, 1]] you see, that the notation package transforms this into valid symbol-name only consisting of letters

Mathematica graphics

At this point you could use ToExpression to define a vector

Table[ToExpression["Subscript[x, " <> ToString[i] <> "]"], {i, 10}]

and the moment you evaluate this you have your new variables

  • $\begingroup$ Hi, halirutan. I tried your method. But InputForm[Subscript[x, 1]] doesn't give expected result. see pasteboard.co/a4QgrQ9ja.png $\endgroup$
    – matheorem
    Commented Dec 15, 2016 at 11:32
  • $\begingroup$ Because I assumed that Subscript is automatically transformed to its box-form. You need to input the subscript with Ctrl+_. Otherwise, it doesn't work. But it must have worked at some point, because I wouldn't have put it in a post without testing. This is really odd. $\endgroup$
    – halirutan
    Commented Dec 15, 2016 at 11:50
  • $\begingroup$ What's wrong with assigning value to a Subscript? I don't seem to run into unexpected behavior with it. Can you please give an example where assigning to Subscript gives wrong results? Maybe it is a performance disaster? $\endgroup$
    – Adobe
    Commented Dec 22, 2016 at 14:01
  • 3
    $\begingroup$ @Adobe Look at this simple example. Especially, pay attention to the error message. Do you truly believe, a newbie would know what he did wrong? The same happens with With and Block. So basically, you cannot use those variables in some local context. $\endgroup$
    – halirutan
    Commented Dec 22, 2016 at 15:37
  • $\begingroup$ @halirutan: You right, it doesn't work in local context, but with Notation it works. However, it breaks TraditionalForm. $\endgroup$
    – Adobe
    Commented Dec 22, 2016 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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