MathGroup Archive 2009

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

Search the Archive

Re: Subscript[x,1] value do not get cleared using Clear["Global`*"] but get removed using Remove["Global`*]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104050] Re: Subscript[x,1] value do not get cleared using Clear["Global`*"] but get removed using Remove["Global`*]
  • From: Peter Breitfeld <phbrf at t-online.de>
  • Date: Sat, 17 Oct 2009 07:02:02 -0400 (EDT)
  • Organization: SFZ Bad Saulgau
  • References: <hb9jt6$ke$1@smc.vnet.net>

"Nasser M. Abbasi" wrote:

> Hello,
> Version 7 on XP Sp2
>
> Before, I used to use Clear["Global`*] to clear all variable, until I just 
> found subscripted variable do not get cleared
>
> In[31]:= Remove["Global`*"]
>
> In[33]:= Subscript[a, 1] = 5
>
> In[34]:= Subscript[a, 1]
> Out[34]= 5
>
> In[35]:= Clear["Global`*"]    --> now clear it
>
> In[36]:= Subscript[a, 1]
> Out[36]= 5      ----> did not clear
>
> In[37]:= Remove["Global`*"]
> In[38]:= Subscript[a, 1]
>
> Out[38]= Subscript[a, 1]   ---> ok, removed
>
> I find the above a bit strange. I first thought may be becuase I did not 
> "symbolize" a_1 using the notation package, but even after doing that, a_1 
> would still not be cleared of its value:
[*** snipp ***] 

This is because 5 is assigned as a Value to Subscript, not to a.

You can do

Subscript[a,1] = .       (is: Unset[Subscript[a,1]])

to clear only the Value associated with a_1

or

Clear[Subscript]

but this will clear all Definitions made to any a_i, b_i,... , which
sometimes is good.

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de


  • Prev by Date: Re: Subscript[x,1] value do not get cleared using Clear["Global`*"] but get removed using Remove["Global`*]
  • Next by Date: Re: Function of list of functions
  • Previous by thread: Re: Subscript[x,
  • Next by thread: Plotting question w/ customized X "buckets"