Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I tried

    In[1]:= Subscript[a, 0] = 1
    Out[1]= 1

    In[2]:= Clear[Subscript[a, 0]]
    During evaluation of In[452]:= Clear::ssym: Subscript[a, 0] is not a symbol or a string. >>

    In[3]:= Clear[a]

    In[4]:= Subscript[a, 0]
    Out[4]= 1

Any idea?

share|improve this question

migrated from stackoverflow.com Jan 30 '12 at 18:12

This question came from our site for professional and enthusiast programmers.

    
This probably should have been marked as a duplicate question on stackoverflow. See [1] (and maybe [2]) Should we also migrate the other post and/or merge? Or are we happy with the question being covered on both sites? Of course, @Spartacus' answer covers most variations of this question. +1! –  Simon Jan 30 '12 at 23:24

1 Answer 1

up vote 15 down vote accepted

Yes you can, with limitations.

You have at least three different ways to make an assignment to a subscripted symbol a0 :

  1. make a rule for Subscript

  2. make a rule for a

  3. "symbolize" a0 using the Notation package/palette

In each case below, when I write e.g. Subscript[a, 1] this can also be entered as a1 by typing a then Ctrl+_ then 1.

When you write:

Subscript[a, 1] = "dog";

You make an assignment to Subscript:

DownValues[Subscript]

{HoldPattern[a1] :> "dog"}

You make a rule for a by using TagSet:

a /: Subscript[a, 2] = "cat";

UpValues[a]

{HoldPattern[a2] :> "cat"}

If you use the Notation palette you mess with underlying Box forms behind the scenes, allowing for assignment to OwnValues:

Mathematica graphics

Each of these can be cleared with either Unset or TagUnset:

Subscript[a, 1] =.

a /: Subscript[a, 2] =.

Mathematica graphics

share|improve this answer
1  
It's worth noting that you can directly type a shortcut for subscripts, but I don't know how to show this here. Namely: a<sub>3</sub> = "lion"; where "<sub>3</sub> should be an actual subscript, typed in the Mathematica Front End by first typing Ctrl _ . –  murray Jan 30 '12 at 18:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.