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

*To*: mathgroup at smc.vnet.net*Subject*: [mg69217] Re: [mg69182] Re: variable "K"? (Really strange behavior . . . )*From*: AES <siegman at stanford.edu>*Date*: Fri, 1 Sep 2006 18:41:33 -0400 (EDT)*References*: <ed6918$jho$1@smc.vnet.net> <200609011041.GAA25571@smc.vnet.net> <acbec1a40609010800w611c1bc2h322f089ea527b535@mail.gmail.com>*Sender*: owner-wri-mathgroup at wolfram.com

At 10:00 AM -0500 9/1/06, Chris Chiasson wrote: >They probably didn't protect K because it is usually only associated >with some type of automatic output - such as an integration dummy >variable. Even then, it usually appears in a unique form like K$12312. >I think it would be okay for you to assign K a value if you wanted to. Oh, you can assign a value to K all right, and it seems to function just fine as a "normal" Mathematica variable or symbol. The problem arises if it's your practice (as it is mine) to start your notebooks with Remove["Global`*"] as the first Input cell, and then define various functions and modules in the immediately following cells, carefully avoiding assigning any numerical values to any symbols or parameters in those functions and modules until after all those definitions have all been completed. Many of the symbols or parameters in those functions or modules will, of course be given numerical values further down in the notebook, when you run specific cases, but starting the notebook with Remove["Global`*"] means (or *should* mean) that if you run the notebook once, then re-run it from the top, the initial functions and modules will not be contaminated by numerical values assigned in the previous run. The problem is, K is apparently *not* cleared out by Remove["Global`*"], and no warning of this is given; and hence if you've used K as a variable in these initial definitions, the value of K from the previous run is "hard-wired" into the initial definitions on the following run -- whether that's what you intended or not.

**References**:**Re: variable "K"? (Really strange behavior . . . )***From:*AES <siegman@stanford.edu>