Re: Subscripted Variables
- To: mathgroup at smc.vnet.net
- Subject: [mg16457] Re: Subscripted Variables
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Sat, 13 Mar 1999 02:21:58 -0500
- Organization: University of Western Australia
- References: <7c59n9$7nl@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Mitchell Kaplan wrote:
> I'd like to use subscripts to make my notation more readable. I'm running
> Windows98 and used the template to add a subscript to a variable -- such as
> "x" with a subscript of "c".
>
> Everything works fine until I try to clear the values. Normally I use the
> following statement to clear my values:
> Clear["Global`*"]. This doesn't seem to work on my subscripted variables.
Because subscripted variables are associated, by default, with
Subscript. You can use association (i.e., /:) to associate the
assignments not with Subscript but with a specific symbol. E.g., look
at the following Notebook:
Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
\(TraditionalForm\`a\_1 = 1\)], "Input"],
Cell[BoxData[
\(TraditionalForm\`1\)], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
\(TraditionalForm\`\(?a\)\)], "Input"],
Cell[BoxData[
\(TraditionalForm\`"Global`a"\)], "Print"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
\(TraditionalForm\`\(?Subscript\)\)], "Input"],
Cell[BoxData[
\(TraditionalForm\`"System`Subscript"\)], "Print"],
Cell[BoxData[
FormBox[
InterpretationBox[GridBox[{
{GridBox[{
{\(\($PrintLiteral["Subscript", Subscript]\)[a, 1] =
1\)}
},
GridBaseline->{Baseline, {1, 1}},
ColumnWidths->0.999,
ColumnAlignments->{Left}]}
},
GridBaseline->{Baseline, {1, 1}},
ColumnAlignments->{Left}],
Definition[ Subscript],
Editable->False], TraditionalForm]], "Print"]
}, Open ]],
Cell[BoxData[
\(TraditionalForm\`Clear[Subscript]\)], "Input"],
Cell[CellGroupData[{
Cell[BoxData[
\(TraditionalForm\`a\_1\)], "Input"],
Cell[BoxData[
\(TraditionalForm\`a\_1\)], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
\(TraditionalForm\`a /: a\_1 = 1\)], "Input"],
Cell[BoxData[
\(TraditionalForm\`1\)], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
\(TraditionalForm\`\(?a\)\)], "Input"],
Cell[BoxData[
\(TraditionalForm\`"Global`a"\)], "Print"],
Cell[BoxData[
FormBox[
InterpretationBox[GridBox[{
{GridBox[{
{\(a /: \($PrintLiteral["Subscript", Subscript]\)[a,
1] = 1
\)}
},
GridBaseline->{Baseline, {1, 1}},
ColumnWidths->0.999,
ColumnAlignments->{Left}]}
},
GridBaseline->{Baseline, {1, 1}},
ColumnAlignments->{Left}],
Definition[ a],
Editable->False], TraditionalForm]], "Print"]
}, Open ]],
Cell[BoxData[
\(TraditionalForm\`Clear[Subscript]\)], "Input"],
Cell[CellGroupData[{
Cell[BoxData[
\(TraditionalForm\`a\_1\)], "Input"],
Cell[BoxData[
\(TraditionalForm\`1\)], "Output"]
}, Open ]],
Cell[BoxData[
\(TraditionalForm\`Clear[a]\)], "Input"],
Cell[CellGroupData[{
Cell[BoxData[
\(TraditionalForm\`a\_1\)], "Input"],
Cell[BoxData[
\(TraditionalForm\`a\_1\)], "Output"]
}, Open ]]
}
]
Cheers,
Paul
____________________________________________________________________
Paul Abbott Phone: +61-8-9380-2734
Department of Physics Fax: +61-8-9380-1014
The University of Western Australia
Nedlands WA 6907 mailto:paul at physics.uwa.edu.au
AUSTRALIA http://www.physics.uwa.edu.au/~paul
God IS a weakly left-handed dice player
____________________________________________________________________