[Date Index] [Thread Index] [Author Index]
Re: Re: variable "K"? (Really strange behavior . . . )
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.