Skip to main content

syntax - Invalid Symbol Characters


What unicode characters are invalid as a Symbol name?


Ideally I'm looking for a complete list.



Here is the current list


"\r\n~`!@#$%^&*()-_=+[{]}\|:;\"',<.>/?"

Answer



394 Unicode characters that are not valid Mathematica Symbols can be found from


ss = Quiet@Table[{tem = "\\:" <> IntegerString[i, 16, 4], Symbol[tem]}, {i, 0, 16^4 - 1}];
notsym = Cases[ss, {z_, Symbol[__]} -> z]

The list is largely but not entirely complete.


To obtain the printable symbols for many of these unicodes, use


Map[FromCharacterCode[{FromDigits[StringDelete[#, "\\:"], 16]}] &, notsym]


for Mathematica 10.1 and later. Otherwise, use (as suggested by Williams and Oleksandr R)


Map[FromCharacterCode[{FromDigits[StringReplace[ToString@#, "\\:" :> ""], 16]}] &, notsym]

{"", " ", " ", "", " ", " ", " ", "!", "\"", "#", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "[", "\", "]", "^", "_", "", "{", "|", "}", "~", "", " ", "¬", "°", "±", "·", "×", "÷", "Ï€", " ", " ", " ", "‘", "’", "“", "”", "
", "
", "⁃", " ", "⁠", "⁢", "←", "↑", "→", "↓", "↔", "↕", "↖", "↗", "↘", "↙", "↤", "↥", "↦", "↧", "↼", "↽", "↾", "↿", "⇀", "⇁", "⇂", "⇃", "⇄", "⇅", "⇆", "⇋", "⇌", "⇐", "⇑", "⇒", "⇓", "⇔", "⇕", "⇤", "⇥", "⇵", "∀", "∂", "∃", "∄", "∆", "∇", "∈", "∉", "∋", "∌", "∍", "∏", "∐", "∑", "−", "∓", "∕", "∖", "∘", "√", "∝", "∞", "∣", "∥", "∦", "∧", "∨", "∫", "∮", "∯", "∲", "∳", "∴", "∵", "∶", "∷", "∼", "≀", "≁", "≂", "≃", "≄", "≅", "≇", "≈", "≉", "≍", "≎", "≏", "≐", "≠", "≡", "≢", "≤", "≥", "≦", "≧", "≨", "≩", "≪", "≫", "≭", "≮", "≯", "≰", "≱", "≲", "≳", "≴", "≵", "≶", "≷", "≸", "≹", "≺", "≻", "≼", "≽", "≾", "≿", "⊀", "⊁", "⊂", "⊃", "⊄", "⊅", "⊆", "⊇", "⊈", "⊉", "⊎", "⊏", "⊐", "⊑", "⊒", "⊓", "⊔", "⊕", "⊖", "⊗", "⊙", "⊢", "⊣", "⊤", "⊥", "⊨", "⊲", "⊳", "⊴", "⊵", "⊻", "⊼", "⊽", "⋀", "⋁", "⋂", "⋃", "⋄", "⋆", "⋚", "⋛", "⋠", "⋡", "⋢", "⋣", "⋨", "⋩", "⋪", "⋫", "⋬", "⋭", "⌈", "⌉", "⌊", "⌋", "⌢", "⌣", "〈", "〉", "␣", "⟂", "⟵", "⟶", "⟷", "⟸", "⟹", "⟺", "⤒", "⤓", "⥎", "⥏", "⥐", "⥑", "⥒", "⥓", "⥔", "⥕", "⥖", "⥗", "⥘", "⥙", "⥚", "⥛", "⥜", "⥝", "⥞", "⥟", "⥠", "⥡", "⥮", "⥯", "⥰", "⧏", "⧐", "⧦", "⩽", "⩾", "⪡", "⪢", "⪯", "⪰", "⫤", " ", "〚", "〛", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "\)", "\!", "\@", "\%", "\^", "\&", "\*", "\(", "\_", "\+", "\/", "\", ""}


(Note: Nonfatal syntax errors above fixed courtesy of Silvia by replacing ":" by "\:".)


Alternative Approach


An alternative, faster approach to obtaining the non-Symbol characters above is


Quiet@Cases[Symbol[FromCharacterCode[#]] & /@ Range[0, 16^4 - 1], Symbol[z__] -> z]


{"", "", "\t", "\n", "", "\f", "\r", " ", "!", "\"", "#", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "[", "\", "]", "^", "_", "", "{", "|", "}", "~", "", " ", "¬", "°", "±", "·", "*", "/", "Ï€", " ", " ", " ", "'", "'", """, """, " ", " ", "⁃", " ", "", "⁢", "←", "↑", "→", "↓", "↔", "↕", "↖", "↗", "↘", "↙", "↤", "↥", "↦", "↧", "↼", "↽", "↾", "↿", "⇀", "⇁", "⇂", "⇃", "⇄", "⇅", "⇆", "⇋", "⇌", "⇐", "⇑", "⇒", "⇓", "⇔", "⇕", "⇤", "⇥", "⇵", "∀", "∂", "∃", "∄", "∆", "∇", "∈", "∉", "∋", "∌", "∍", "∏", "∐", "∑", "−", "∓", "∕", "∖", "∘", "√", "∝", "∞","∣", "∥", "∦", "∧", "∨", "∫", "∮", "∯", "∲", "∳", "∴", "∵", "∶", "∷", "∼", "≀", "≁", "≂", "≃", "≄", "≅", "≇", "≈", "≉", "≍", "≎", "≏", "≐", "!=", "≡", "≢", "<=", ">=", "≦", "≧", "≨", "≩", "≪", "≫", "≭", "≮", "≯", "≰", "≱", "≲", "≳", "≴", "≵", "≶", "≷", "≸", "≹", "≺", "≻", "≼", "≽", "≾", "≿", "⊀", "⊁", "⊂", "⊃", "⊄", "⊅", "⊆", "⊇", "⊈", "⊉", "⊎", "⊏", "⊐", "⊑", "⊒", "⊓", "⊔", "⊕", "⊖", "⊗", "⊙", "⊢", "⊣", "⊤", "⊥", "⊨", "⊲", "⊳", "⊴", "⊵", "⊻", "⊼", "⊽", "⋀", "⋁", "⋂", "⋃", "⋄", "⋆", "⋚", "⋛", "⋠", "⋡", "⋢", "⋣", "⋨", "⋩", "⋪", "⋫", "⋬", "⋭", "⌈", "⌉", "⌊", "⌋", "⌢", "⌣", "〈", "〉", "␣", "⟂", "⟵", "⟶", "⟷", "⟸", "⟹", "⟺", "⤒", "⤓", "⥎", "⥏", "⥐", "⥑", "⥒", "⥓", "⥔", "⥕", "⥖", "⥗", "⥘", "⥙", "⥚", "⥛", "⥜", "⥝", "⥞", "⥟", "⥠", "⥡", "⥮", "⥯", "⥰", "⧏", "⧐", "⧦", "⩽", "⩾", "⪡", "⪢", "⪯", "⪰", "⫤", " ", "[[", "]]", "<|", "|>", " ", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "<->", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "==", "", "", "", "", "", "", "", "", ":>", "", "->", "", "", "", "", "", "", "", "", "", "", "", "E", "I", "", "", "<<", ">>", "", "", "", "", "", "\)", "\!", "\@", "\%", "\^", "\&", "\*", "\(", "\_", "\+", "\/", "\", "=="}


This list has one more character, \:0000 and also displays a few of the characters differently. Note also that one of the characters displays as a linefeed. (I had to copy this second list in InputForm, which was unnecessary for the earlier list.) The corresponding Unicode is given by


IntegerString[#, 16, 4] & /@ Quiet@Flatten@Cases[Symbol[FromCharacterCode[#]] & /@ 
Range[0, 16^4 - 1], Symbol[z__] -> ToCharacterCode[z]]

{"0000", "0007", "0009", "000a", "000b", "000c", "000d", "0020", "0021", "0022", "0023", "0025", "0026", "0027", "0028", "0029", "002a", "002b", "002c", "002d", "002e", "002f", "0030", "0031", "0032", "0033", "0034", "0035", "0036", "0037", "0038", "0039", "003a", "003b", "003c", "003d", "003e", "003f", "0040", "005b", "005c", "005d", "005e", "005f", "0060", "007b", "007c", "007d", "007e", "007f", "00a0", "00ac", "00b0", "00b1", "00b7", "00d7", "00f7", "03c0", "2005", "2009", "200a", "2018", "2019", "201c", "201d", "2028", "2029", "2043", "205f", "2060", "2062", "2190", "2191", "2192", "2193", "2194", "2195", "2196", "2197", "2198", "2199", "21a4", "21a5", "21a6", "21a7", "21bc", "21bd", "21be", "21bf", "21c0", "21c1", "21c2", "21c3", "21c4", "21c5", "21c6", "21cb", "21cc", "21d0", "21d1", "21d2", "21d3", "21d4", "21d5", "21e4", "21e5", "21f5", "2200", "2202", "2203", "2204", "2206", "2207", "2208", "2209", "220b", "220c", "220d", "220f", "2210", "2211", "2212", "2213", "2215", "2216", "2218", "221a", "221d", "221e", "2223", "2225", "2226", "2227", "2228", "222b", "222e", "222f", "2232", "2233", "2234", "2235", "2236", "2237", "223c", "2240", "2241", "2242", "2243", "2244", "2245", "2247", "2248", "2249", "224d", "224e", "224f", "2250", "2260", "2261", "2262", "2264", "2265", "2266", "2267", "2268", "2269", "226a", "226b", "226d", "226e", "226f", "2270", "2271", "2272", "2273", "2274", "2275", "2276", "2277", "2278", "2279", "227a", "227b", "227c", "227d", "227e", "227f", "2280", "2281", "2282", "2283", "2284", "2285", "2286", "2287", "2288", "2289", "228e", "228f", "2290", "2291", "2292", "2293", "2294", "2295", "2296", "2297", "2299", "22a2", "22a3", "22a4", "22a5", "22a8", "22b2", "22b3", "22b4", "22b5", "22bb", "22bc", "22bd", "22c0", "22c1", "22c2", "22c3", "22c4", "22c6", "22da", "22db", "22e0", "22e1", "22e2", "22e3", "22e8", "22e9", "22ea", "22eb", "22ec", "22ed", "2308", "2309", "230a", "230b", "2322", "2323", "2329", "232a", "2423", "27c2", "27f5", "27f6", "27f7", "27f8", "27f9", "27fa", "2912", "2913", "294e", "294f", "2950", "2951", "2952", "2953", "2954", "2955", "2956", "2957", "2958", "2959", "295a", "295b", "295c", "295d", "295e", "295f", "2960", "2961", "296e", "296f", "2970", "29cf", "29d0", "29e6", "2a7d", "2a7e", "2aa1", "2aa2", "2aaf", "2ab0", "2ae4", "3000", "301a", "301b", "f113", "f114", "f360", "f361", "f380", "f382", "f383", "f384", "f39e", "f3a2", "f3a3", "f3a8", "f3a9", "f3ad", "f3b1", "f3b2", "f3b3", "f3b4", "f3bd", "f3be", "f3bf", "f3c6", "f3c7", "f3c8", "f3c9", "f3ce", "f3d0", "f3d1", "f3d2", "f3d3", "f3d4", "f3d5", "f3d6", "f3d7", "f3d8", "f3d9", "f3da", "f3db", "f3dc", "f3dd", "f3de", "f400", "f401", "f402", "f412", "f413", "f422", "f423", "f424", "f427", "f428", "f429", "f42b", "f42d", "f42e", "f42f", "f431", "f432", "f4a0", "f4a1", "f4a2", "f4a3", "f4a4", "f4a5", "f51e", "f51f", "f520", "f522", "f523", "f525", "f526", "f52a", "f52b", "f603", "f604", "f605", "f606", "f74b", "f74c", "f74d", "f74e", "f74f", "f760", "f761", "f762", "f765", "f767", "f76d", "f76e", "f76f", "f7c0", "f7c1", "f7c2", "f7c5", "f7c6", "f7c7", "f7c8", "f7c9", "f7ca", "f7cb", "f7cc", "f7cd", "f7d9"}


Caution


Being a Symbol and being useful as a Symbol are two different things. For instance


Symbol[FromCharacterCode[62378]]


returns a nondisplaying symbol; i.e., the corresponding Out appears empty. Nonetheless, a Symbol really is in that Out line.


Cases[{%}, z_Symbol -> True]
(* True *)

But, it is not obvious how one would use this or many others nondisplaying Symbols.


Comments

Popular posts from this blog

plotting - How to draw lines between specified dots on ListPlot?

I would like to create a plot where I have unconnected dots and some connected. So far, I have figured out how to draw the dots. My code is the following: ListPlot[{{1, 1}, {2, 2}, {3, 3}, {4, 4}, {1, 4}, {2, 5}, {3, 6}, {4, 7}, {1, 7}, {2, 8}, {3, 9}, {4, 10}, {1, 10}, {2, 11}, {3, 12}, {4,13}, {2.5, 7}}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full] I have thought using ListLinePlot command, but I don't know how to specify to the command to draw only selected lines between the dots. Do have any suggestions/hints on how to do that? Thank you. Answer One possibility would be to use Epilog with Line : ListPlot[ {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {1, 4}, {2, 5}, {3, 6}, {4, 7}, {1, 7}, {2, 8}, {3, 9}, {4, 10}, {1, 10}, {2, 11}, {3, 12}, {4, 13}, {2.5, 7}}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full, Epilog -> { Line[ ...

dynamic - How can I make a clickable ArrayPlot that returns input?

I would like to create a dynamic ArrayPlot so that the rectangles, when clicked, provide the input. Can I use ArrayPlot for this? Or is there something else I should have to use? Answer ArrayPlot is much more than just a simple array like Grid : it represents a ranged 2D dataset, and its visualization can be finetuned by options like DataReversed and DataRange . These features make it quite complicated to reproduce the same layout and order with Grid . Here I offer AnnotatedArrayPlot which comes in handy when your dataset is more than just a flat 2D array. The dynamic interface allows highlighting individual cells and possibly interacting with them. AnnotatedArrayPlot works the same way as ArrayPlot and accepts the same options plus Enabled , HighlightCoordinates , HighlightStyle and HighlightElementFunction . data = {{Missing["HasSomeMoreData"], GrayLevel[ 1], {RGBColor[0, 1, 1], RGBColor[0, 0, 1], GrayLevel[1]}, RGBColor[0, 1, 0]}, {GrayLevel[0], GrayLevel...

Is there a way to do conditional matrix loop using 'continue'

I have the following: n = 3; m = 5; ww = RandomReal[{0, 0.1}, {n, n}]; uu = RandomReal[{0, 1}, {m, n}]; pp = RandomReal[{0, 1}, {n, n}]; ss = RandomInteger[{0, 5}, {m, n}]; Grid[{{"ww", "uu", "pp", "ss"}, {ww // TableForm, uu // TableForm, pp // TableForm, ss // TableForm}}, Spacings -> {5, 2}, Dividers -> All] where I would like to look at every element of matrix ss and produce a matrix tt , with zeroes at the locations in ss which have zeroes, and in all other positions do the following: tt = (-1/Subscript[ww, m]) Log[(1 - uu)/(Subscript[pp, m - 1])], where Subscript[ww, m] is the value at index of ww matrix and where Subscript[pp, m - 1] is the value at index-1 of pp matrix. So for example if the first value ever read from matrix ss happens to be 2, then value taken from matrix ww would be from the row 2, but from pp would be from row 1. Also how to tell difference between a 0 as a valid value from within the matrix elemen...