Function Repository Resource:

# SymbolToSubscript (1.0.0)current version: 3.0.0 »

Convert symbols into subscript forms

Contributed by: E. Chan-López & Jaime Manuel Cabrera  |  Ramón Eduardo Chan López
 ResourceFunction["SymbolToSubscript"][expr] gives the representation with subscripts for one or more unprotected symbols expr.

## Details

ResourceFunction["SymbolToSubscript"] does not act on numbers, it just returns them.
ResourceFunction["SymbolToSubscript"] does not act on symbols that already have subscripts, it just returns them.
ResourceFunction["SymbolToSubscript"] does not act on protected heads of functions.
ResourceFunction["SymbolToSubscript"][expr,"MultipleIndices"] can be used on matrices and arrays, where it separates numbers with commas.

## Examples

### Basic Examples (2)

Applying SymbolToSubcript for one unprotected symbol:

 In[1]:=
 Out[1]=

Applying SymbolToSubcript to a list of unprotected symbols:

 In[2]:=
 Out[2]=
 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=

### Scope (3)

Applying SymbolToSubscripts to a list of functions with protected heads:

 In[5]:=
 Out[5]=

Indexed for symbolic matrices:

 In[6]:=
 Out[7]=

Both the base and subscript in the output are symbols and inherit any existing definitions:

 In[8]:=
 In[9]:=
 Out[9]=

### Applications (3)

Format a symbolic polynomial:

 In[10]:=
 In[11]:=
 Out[11]=

Format a symbolic matrix:

 In[12]:=
 In[13]:=
 Out[13]=

Using MultipleIndices option for symbolic matrices:

 In[14]:=
 Out[14]=
 In[15]:=
 Out[15]=

Using :

 In[16]:=
 Out[16]=

Using :

 In[17]:=
 In[18]:=
 Out[18]=

Define a function for making a Vandermonde matrix:

 In[19]:=

Format a Vandermonde matrix:

 In[20]:=
 Out[20]=

The SymbolToSubscript command allows to be used correctly when we have expressions with subscripts that are written as symbols:

 In[21]:=
 Out[21]=
 In[22]:=
 Out[22]=
 In[23]:=
 Out[23]=
 In[24]:=
 Out[24]=
 In[25]:=
 Out[25]=

Using :

 In[26]:=
 Out[26]=
 In[27]:=
 Out[27]=

### Possible Issues (1)

Before getting the subscript format, SymbolToSubscript separates the expression x1y2 as {“x”,“1y2”}, and then passes each part to input form using ToExpression. Therefore, in the example x1y2 we get xy2 instead x1y2:

 In[28]:=
 Out[28]=

## Version History

• 3.0.0 – 09 August 2023
• 2.0.0 – 26 June 2023
• 1.1.0 – 22 August 2022
• 1.0.0 – 19 July 2022