Basic Examples (2)
Convert a symbol to a subscripted symbol:
Convert multiple symbols:
Scope (9)
Use with a list of expressions:
Use with a symbolic matrix:
Use with a tensor of rank 3:
Use with a tensor of rank 4:
Use with a nonlinear system of ordinary differential equations:
Use with a system of partial differential equations:
SymbolToSubscript optionally uses "NestedIndices" to represent subscriptable symbols with multiple indices in a nested format:
SymbolToSubscript optionally uses "MultipleIndices" to represent subscriptable symbols with multiple indices, separating them by commas:
Both the base and subscript in the output are symbols and inherit any existing definitions:
Options (1)
FormatStyle (1)
SymbolToSubscript includes an option that enables its outputs to be represented in a string format:
Applications (3)
Format a symbolic polynomial:
Format a symbolic matrix:
Use SymbolToSubscript and TeXForm:
Define a function for making a Vandermonde matrix:
Format a Vandermonde matrix:
The SymbolToSubscript command allows TeXForm to be used correctly when we have expressions with subscripts that are written as symbols:
Possible Issues (2)
The function SymbolToSubscript, when transforming an expression into subscript format, may encounter a potential issue. As the function dissects the expression and processes each component via ToExpression, numerical expressions are simplified by default. For instance, if the only numeric indices we have are zero followed by one, we are left with just the number one. This interpretation leads to the conversion of this pair of numbers into a single subscript, which may not be the intended outcome. To circumvent this problem and provide more granular control over the output, the function is equipped with options that allow for improved handling of how expression components are processed and displayed. Let's illustrate this with an example:
To handle the above problem, SymbolToSubscript has the "ToStringFormat" option:
We can also address this issue using the options for nested indices and multiple indices separated by commas, as demonstrated below:
The SymbolToSubscript function provides a simple way to handle subscriptable symbols. However, it's essential to be mindful of protected symbols such as E (exponential constant), π (Pi), I (Imaginary unit), among others when using this function. Let's illustrate this with an example:
To avoid the above misunderstandings, users are highly advised not to use protected symbols.