MathGroup Archive 2001

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

Search the Archive

Re: Clearing Subscripted Variables?


Randall,

Your definitions, below, are tagged by  Subscript, which has context
"Symbol`" not "Global`" so they are not cleared
by Clear["Global`*"].

    For[i=0,i<10,i++,f/:Subscript[f,i]=0]

It would be inadvisable to use  Clear["Symbol`*"]., but we can use

    Clear[Subscript];

Or

    For[i=0,i<10,i++,Subscript[f,i]=.


Alternatively we could alter the definition to tag the stored rule with f
(as UpValues of f}

    For[i = 0, i < 4, i++, f /: Subscript[f, i] = 0]

Then we can use

    Clear["Global`*"]

or the briefer

    Clear["`*"]

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Randall Edick" <randydebbi1 at home.com> wrote in message
news:9s1usi$o4p$1 at smc.vnet.net...
> Math Group,
>
> I initialized a set of subscripted variables
>
> For[i=0,i<10,i++,Subscript[f,i]=0]
>
> Then, can't Clear or Unset the values.  Things such as Clear["Global`*"]
> don't work.  Why?
> I guess its being replaced by the value 0 before the Clear.  How can I
stop
> that (I guess
> SetDelayed would have work better) but how can I lose this definition?
>
> --
>
>
>






  • Prev by Date: lists w/o double brackets
  • Next by Date: Re: Zero does not equal Zero
  • Previous by thread: Re: Clearing Subscripted Variables?
  • Next by thread: Re: Clearing Subscripted Variables?