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

calculus and analysis - Integral of the Sinc product

Let us consider the following integral $$ B_n = \int_0^\infty \prod_{k=1,3,5,\dots}^n\frac{\sin (x/k)}{x/k}dx $$ By definition, Sinc[x] == Sin[x]/x , therefore B[n_?OddQ] := Integrate[Product[Sinc[x/k], {k, 1, n, 2}], {x, 0, Infinity}] B /@ Range[1, 13, 2] {Pi/2, Pi/2, Pi/2, Pi/2, Pi/2, Pi/2, Pi/2} OK, everything is fine. But... B[15] 467807924713440738696537864469 Pi/935615849440640907310521750000 What's going on? Answer As Eckhard wrote in comments B[n] is the n-th Borwein integral . (The letter B was not accidental :) ) This funny properties of Borwein integrals is related to the Fourier transform of Sinc function FourierTransform[Sinc[x], x, k] 1/2 Sqrt[Pi/2] (Sign[1 - k] + Sign[1 + k]) Plot[%, {k, -2, 2}, Filling -> 0] which is the box function. The result is $\pi/2$ while the sum $$ 1/3+1/5+\dots+1/n $$ B_n = \frac{\pi}{2} - \pi \bigg(\sum_{k=3,5,\ldots}^n\frac{1}{k} -1\biggr)^\frac{n-1}{2}\prod_{k=3,5,\dots}^n\frac{k}{k-1}. $$ For $n=15$ it is equal to $$ \frac{46780...

list manipulation - Solving word search puzzles

I am trying to create a code that can identify the following terms in a grid of letters: MATHEMATICA, STACK, EXCHANGE and USERS. list1={"M","S","T","A","S","I","S","X","X","T","R","X"}; list2={"A ","T ","H ","X ","R ","X ","G ","R ","S ","H ","X ","A"}; list3={"M","A","T","H","E","M","A","T","I","C","A","I"}; list4={"A","X","S","G","S","X","A","I","R","T","X","T"}; list5={"T","I","T","G","U","C","C","I","R","N",...

How do I constrain movement for lists of Locators using 2nd argument of Dynamic?

I need to display edge labels of a graph in a way that allows the edge labels to be moved. Locator seems the simplest and most obvious function to use. My application requires an interface that generates new graphs with different numbers of vertices and edges, so I can't treat the locators individually. With[ {coords = {{1.08, 0.94}, {1.08, 0.036}, {0., 0.97}, {0., 0.}, {1.94, 0.49}}, edges = {{1, 2}, {1, 3}, {2, 5}, {3, 4}, {4, 2}, {5, 1}}}, DynamicModule[ {edgePosns = Table[0.5, {Length@edges}]}, (betweenPnt[a_, b_, l_] := (1 - l) a + l b; DynamicModule[ {edgeCentres = MapThread[ With[{av = coords[[#1[[1]]]], bv = coords[[#1[[2]]]]}, Dynamic[betweenPnt[av, bv, #2]]] &, {edges, edgePosns}]}, Graphics[ GraphicsComplex[ coords, {{Line[edges]}, {Darker@Red, PointSize[0.02], Map[Point, Range[5]]}, Map[Locator, edgeCentres]}], ImageSize -> 400]])]] The locators can be moved, as expected....