MathGroup Archive 2003

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

Search the Archive

RE: How to Remove Removed[Derivative]?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42860] RE: [mg42820] How to Remove Removed[Derivative]?
  • From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
  • Date: Wed, 30 Jul 2003 19:31:25 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

>-----Original Message-----
>From: lepetyuk at hotmail.com [mailto:lepetyuk at hotmail.com]
To: mathgroup at smc.vnet.net
>Sent: Wednesday, July 30, 2003 10:08 AM
>To: mathgroup at smc.vnet.net
>Subject: [mg42860] [mg42820] How to Remove Removed[Derivative]?
>
>
>Hello MathGroup:
>
>When I execute the following list of expressions (in Mathematica
>v.4.2) I expect to get "f'[5]" from the last expression instead
>of "3". Is it a bug or something else?
>
>----------------------------
>f'[5]
>f'[_] = 2;
>f'[5]
>Remove[Derivative]
>f'[5]
>f'[_] = 3;
>f'[5]
>Remove[Derivative]
>f'[5]
>----------------------------
>
>If Remove[] is replaced by Clear[] the output from the last
>expression is "f'[5]" as expected. Would it be the reason to
>always use Clear[] rather than Remove[]?
>
>Thank you,
>Vadym
>

I cannot Remove Removed[Derivative], as this is no symbol:

In[15]:= ?Removed
"Removed[string] is printed to indicate a symbol that has been removed."


However, if a symbol is Removed, other symbols still might refer to that,
this is indicated by Removed["string-for-name-of-symbol"], see e.g.

In[1]:= s = d
Out[1]= d

In[2]:= d[f][_] = 2
Out[2]= 2

In[3]:= d[f][5]
Out[3]= 2

In[4]:= ?? d

        Global`d

        d[f][_] = 2

In[5]:= Remove[d]

In[6]:= s
Out[6]= Removed["d"]

In particular the system doesn't crash.


Now, Removed["d"] isn't accessible, you can't see downvalues or anything of
it.

However, by miracle, you still may assign a value to it:

In[7]:= s[f][_] = 3
Out[7]= 3

In[8]:= ?s

        Global`s

        s = Removed["d"]

The definition made is not associated with s, but it is there, somewhere

In[9]:= s[f][5]
Out[9]= 3

In[10]:= s[f][5] // Trace
Out[10]= {{{s, Removed["d"]}, Removed["d"][f]}, Removed["d"][f][5], 3}

so it is associated with Removed["d"].


Similar things happen with Derivative. Your second assignment goes to 
Removed["Derivative"] and the expression

f'[5] recalls from there

The second attempt to Remove[Derivative] after that does not work, this
removes "Derivative" (which does not exits, or is created anew and then
removed, I don't know), but it does not remove Removed["Derivative"] (and
shall not, if you want to keep alive).


Just the same as happens here:

In[11]:= Remove[d]

In[12]:= s[f][5]
Out[12]= 3



BTW: you shouldn't remove Derivative, nor Clear it. Perhaps you may reach
your ends whith shadowing? Or what was it, you wanted to attain in first
place?

--
Hartmut Wolf


  • Prev by Date: Re: New version, new bugs
  • Next by Date: Re: Background Colors in The Format Menu
  • Previous by thread: Re: How to Remove Removed[Derivative]?
  • Next by thread: How to add a condition to NDSolve?