How do I create subscripted variables?
 In Mathematica 3.0 and 4.0, subscripted variables like are expressions rather than symbols. For example, is parsed as Subscript[x, 0]. There are many instances in which you would want to have treated as if it were a symbol. You can do this with the package Utilities`Notation`. This package can be loaded with Needs. In[1]:= |  |
The command to use from the package Utilities`Notation` is called Symbolize. In[2]:= |  |
In this example, Symbolize generates a symbol to use in place of the subscripted expression and adds rules for the following two operations. | 1. | When is sent from the front end to the kernel, it is translated into the corresponding symbol. |
| 2. | When the front end receives that symbol from the kernel, it is displayed as . |
The symbol that is used in place of is generated automatically by Symbolize. The name of this symbol will typically have the form x_Subscript_n, but in most cases, you do not need to know the name of this symbol. If you want to control the name of this symbol, you can do so using the command Notation, which is accessible from the palette that is created by the package Utilities`Notation`. To use in a function definition, you will need to insert the colon character (:) between the subscripted variable and the underscore, as in the following. In[3]:= |  |
Out[3]= |
 |
If you have problems using Symbolize, make sure you have the latest sources. http://support.wolfram.com/mathematica/packages/utilities/latest.html If you have problems when typing Symbolize, see the following FAQ. http://support.wolfram.com/mathematica/packages/utilities/typing.html If you have problems when saving subscripts in notebooks, see the following FAQ. http://support.wolfram.com/mathematica/interface/notebooks/savediffersopen.html Download this FAQ as a Mathematica 5.2 Notebook
Questions or comments? Send email to support@wolfram.com.
|