MathGroup Archive 2006

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

Search the Archive

Re: variable "K"? (Really strange behavior . . . )

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69182] Re: variable "K"? (Really strange behavior . . . )
  • From: AES <siegman at stanford.edu>
  • Date: Fri, 1 Sep 2006 06:41:08 -0400 (EDT)
  • Organization: Stanford University
  • References: <ed6918$jho$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Final comments (my final comments, anyway) on the "strange behavior of 
K" observation I posted:

1)  The explanation clearly lies in the two responses appended below 
(and thanks).

2)  Some further exploration on my part seems to show that the 7 single 
capital letters  C  D  E  I  K  N  O  all have (at present, anyway) one 
or another form of special "system" meaning in Mathematica.  Six of 
these 7 letters (all but K) also share the properties that they

    (a) Have an entry in the online Help system, and

    (b) Issue a "Protected" warning if you try to use them as symbols.

Unfortunately, K has neither of these attributes, which makes it much 
less apparent to non-experts that using it as a symbol name will cause 
bizarre difficulties -- especially since all the other 19 single 
capitals can apparently be used as symbols without trouble.

3)  It might might be nice if Wolfram would Protect and/or include in 
the online Help system *all* the special symbols in the entire system.  
But, this may be difficult technically (?), and leaves open the chance 
for some of these special symbols to get inadvertently omitted.

So, despite the attractions of writing an optics notebook using the 
standard notation of  "a" for radius of a circular fiber, "v" for its 
fiber v parameter, "A" for its cross sectional area, "V" for its volume, 
and "K" as the standard notation for the thermal conductivity of glass, 
I guess the safest course is for the user to conform to the computer, 
and never use a capital letter as the initial letter of a symbol.

=====================================================
Notice the usage message for K. This is because K is a System symbol:

In[2]:= Context[K]

Out[2]= System`

Carl Woll
Wolfram Research
=====================================================
The answer seems to be that K's Context is System, not Global, and unlike
many System symbols it is not Protected, which is why it could be set to
0.6. In fact, of the 1984 symbols in System (in version 5.2)  515 are not
protected, and K is one of those:
  Length[Select[Names["System`*"], FreeQ[Attributes[#], Protected] &]]
Luckily, things like Pi, E and I are protected!

Dr A.H. Harker
Department of Physics and Astronomy
University College London
=====================================================


  • Prev by Date: RE: Unexpected "Invalid comparison" error when plotting function defined with a Condition pattern
  • Next by Date: Re: "Anti-Comments"?
  • Previous by thread: Re: the ellipse and the circle
  • Next by thread: Re: Re: variable "K"? (Really strange behavior . . . )