# How to create symbol whose name has subscript?

I can do

Symbol["foobar"]


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

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


doesn't work.

-
Subscript[\[Theta], 1] = 20 works. – drN Oct 27 '12 at 17:27
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? – qazwsx Oct 27 '12 at 17:34
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. – drN Oct 27 '12 at 17:40
Have you seen this?: mathematica.stackexchange.com/questions/1004/… – DavidC Oct 27 '12 at 17:44
How about the Notation package? – Sjoerd C. de Vries Oct 27 '12 at 18:23

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

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

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

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

Needs["Notation"]
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

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

Names["x\[UnderBracket]Subscript\[UnderBracket]*"]
(*
{"x\[UnderBracket]Subscript\[UnderBracket]1",
"x\[UnderBracket]Subscript\[UnderBracket]10",
"x\[UnderBracket]Subscript\[UnderBracket]2",
"x\[UnderBracket]Subscript\[UnderBracket]3",
"x\[UnderBracket]Subscript\[UnderBracket]4",
"x\[UnderBracket]Subscript\[UnderBracket]5",
"x\[UnderBracket]Subscript\[UnderBracket]6",
"x\[UnderBracket]Subscript\[UnderBracket]7",
"x\[UnderBracket]Subscript\[UnderBracket]8",
"x\[UnderBracket]Subscript\[UnderBracket]9"}
*)
`
-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.880530834197998, "perplexity": 1341.3691696202782}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2016-30/segments/1469257827781.76/warc/CC-MAIN-20160723071027-00060-ip-10-185-27-174.ec2.internal.warc.gz"}