MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Information about non-symbol heads

  • To: mathgroup at smc.vnet.net
  • Subject: [mg6172] Re: [mg6152] Information about non-symbol heads
  • From: "C. Woll" <carlw at u.washington.edu>
  • Date: Thu, 27 Feb 1997 02:52:17 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

On Mon, 24 Feb 1997, James D Hanson wrote:

> How can I get Mathematica 3.0 to tell me what it knows about non-symbolic
> heads? To explain what I mean, take a look at a symbolic head. I define b
> as a function, the function works, and when I ask Mma about it it tells me
> the definition. 
> 
> In[1]:=
> b[x_] := x^2
> 
> In[2]:=
> b[2]
> 
> Out[2]=
> 4
> 
> In[3]:=
> ?b
> 
> "Global`b"
> 
> b[x_] := x^2
> 
> 
> So far, so good. Now, suppose I want to use a subscripted variable. I
> define the function the same way, and it works.
> 
> In[4]:=
> \!\(a\_0[x_]\  := \ x^4\)
> 
> In[5]:=
> \!\(a\_0[2]\)
> 
> Out[5]=
> 16
> 
> 
> But now, when I ask about it, Mma replies that my subscripted variable is
> not a symbol or a string.
> 
> 
> In[6]:=
> \!\(\(?a\_0\)\)
> 
> \!\(Information::"ssym" \( : \ \) "\!\(a\_0\) is not a symbol or a string."\)
> 
> Out[6]=
> \!\(Information[a\_0, LongForm \[Rule] False]\)
> 
> 
> So, is there any way to get Mma to tell me the information about a_sub_0?
> 
> -- 
> James D. Hanson                          ph. (334) 844-5044
> Department of Physics                    fax (334) 844-4613
> 206 Allison Laboratory
> Auburn University, AL 36849-5311         hanson at physics.auburn.edu
> 
> 
Hi James,

Take a look at the FullForm[] of a subscripted variable, and you will see
that for example a_0 (using tex notation) is simply

Subscript[a,0].

Thus, a_0 is not a symbol, so that Information[] (or ??) won't work on it.
On the other hand, the function definition that you created for a_0 is
available, it's just stored under Subscript. Thus, try 

??Subscript

and you'll find your function definition. The only problem is that if you
have a lot of subscript definitions, it may be hard to find the one you're
interested in. I couldn't think of a way to narrow down the output of
??Subscript to just the function you're interested in. You could also look
into the function Definition[].

Carl



  • Prev by Date: Re: names, symbols, and contexts
  • Next by Date: Re: conditional package evaluation
  • Previous by thread: Re: Information about non-symbol heads
  • Next by thread: Re: conditional package evaluation