Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg104059] Re: Subscript[x,1] value do not get cleared using Clear["Global`*"] but get removed using Remove["Global`*]
  • From: Colin Rose <colin at tri.org.au>
  • Date: Sat, 17 Oct 2009 07:03:42 -0400 (EDT)
  • References: <hb9jt6$ke$1@smc.vnet.net>

 "Nasser M. Abbasi" <nma at 12000.org> wrote:

> 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 related vein, I find the following long-standing behaviour to be 
irksome and illogical:


In[1]:= Subscript[x, 1] = 3

In[2]:= Clear[Subscript[x, 1]]

Clear::ssym: Subscript[x, 1] is not a symbol or a string. >>

To clear the subscript, you have to use Unset, which produces beeps if 
the Subscript[x,1] has not been assigned a value. All so messy. 

Why not just make Clear do what it is meant to do, or at least, make it 
do what people reasonably expect it will do?

Cheers

Colin


  • Prev by Date: Re: Coefficient Question
  • Next by Date: Re: Subscript[x,1] value do not get cleared using Clear["Global`*"] but get removed using Remove["Global`*]
  • Previous by thread: Subscript[x,1] value do not get cleared using Clear["Global`*"] but get removed using Remove["Global`*]
  • Next by thread: Re: Subscript[x,