MathGroup Archive 2005

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

Search the Archive

Re: Clear subscripted variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58319] Re: Clear subscripted variables
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 28 Jun 2005 05:13:19 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <d9ispk$cpd$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

ClearSubscript[x_Symbol] := (First /@
  Select[DownValues[Subscript],
    MatchQ[First[#], 
Verbatim[HoldPattern][Subscript[x, _]]] &]) /.
      HoldPattern :> Unset



and

ClearSubscript[x] will remove all Subscript[x,_] 
values.

Regards

  Jens

"Mukhtar Bekkali" <mbekkali at gmail.com> schrieb im 
Newsbeitrag news:d9ispk$cpd$1 at smc.vnet.net...
> Here is the code (x\_i stands for x subscript 
> i):
>
> Table[{Print[x\_i = i]; Clear[x]; Remove[x]; 
> Unset[x]; Print[x\_i]},
> {i, 1, 2}]
>
> I expected that x\_i is cleared at the end of 
> the loop but it isn't
>
> If I insert Clear[Subscript] in the loop then it 
> is cleared, but not
> desirable since it clears all variables with 
> subscripts.
>
> What command shall I use to clear specific 
> subscripted variables?
>
> Mukhtar Bekkali
> 



  • Prev by Date: Optimal number of sheets
  • Next by Date: Re: Re: Mathematica Visualization site - update
  • Previous by thread: Re: Clear subscripted variables
  • Next by thread: Re: Re: Mathematica program generating sequence ofpoints stalls for no apparent reason.