MathGroup Archive 2007

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

Search the Archive

Re: question about Protect

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75120] Re: question about Protect
  • From: Daniel Huber <dh at metrohm.ch>
  • Date: Wed, 18 Apr 2007 04:54:10 -0400 (EDT)
  • References: <f013jm$8f5$1@smc.vnet.net>

Hi Dimitris,
it seems like Integrate protects Limit. What is strange is, that the 
protection works only once. Looks like a bug to me:
Unprotect[Limit];
Attributes[Limit]
Integrate[1/Sqrt[Abs[x]],{x,-1,2}]
Attributes[Limit]
Unprotect[Limit];
Attributes[Limit]
Integrate[1/Sqrt[Abs[x]],{x,-1,2}]
Attributes[Limit]
Daniel

dimitris wrote:
> Hello.
> 
> The following code add a rule for the Limit command
> 
> In[1]:=
> Off[General::spell1]
> Unprotect[Limit];
> Limit[a___] := Null /; (Print[InputForm[limit[a]]]; False)
> 
> For example
> 
> In[7]:=
> Integrate[1/Sqrt[Abs[x]], {x, -1, 2}]
> 
>>From In[7]:=
> InputForm[limit[1 + (1 + x)/2 + (3*(1 + x)^2)/8, x -> -1, Direction ->
> -1, Assumptions -> True]]
>>From In[7]:=
> InputForm[limit[(-I)/Sqrt[x], x -> 0, Direction -> 1, Assumptions ->
> True]]
>>From In[7]:=
> InputForm[limit[I/Sqrt[x], x -> 0, Assumptions -> True]]
>>From In[7]:=
> InputForm[limit[2*Sqrt[x], x -> 1, Direction -> 1, Assumptions ->
> True]]
>>From In[7]:=
> InputForm[limit[2*Sqrt[x], x -> 0, Direction -> -1, Assumptions ->
> True]]
>>From In[7]:=
> InputForm[limit[1/Sqrt[x], x -> 0, Direction -> -1, Assumptions ->
> True]]
>>From In[7]:=
> InputForm[limit[1/Sqrt[x], x -> 0, Assumptions -> True]]
>>From In[7]:=
> InputForm[limit[1/Sqrt[2] - (-2 + x)/(4*Sqrt[2]) + (3*(-2 + x)^2)/
> (32*Sqrt[2]), x -> 2, Direction -> 1, Assumptions -> True]]
>>From In[7]:=
> InputForm[limit[2*Sqrt[x], x -> 2, Direction -> 1, Assumptions ->
> True]]
>>From In[7]:=
> InputForm[limit[2*Sqrt[x], x -> 0, Direction -> -1, Assumptions ->
> True]]
> 
> Out[7]=
> 2*(1 + Sqrt[2])
> 
> Note that I have NOT protect the Limit command. Nevertheless,
> 
> In[8]:=
> Clear[Limit]
> Clear::wrsym: Symbol Limit is Protected.
> 
> 
> Why do we get this message? How Limit was protected WITHOUT telling
> so?
> 
> In[12]:=
> Information["Limit", LongForm -> True]
> 
> "Limit[expr, x->x0] finds the limiting value of expr when x approaches
> x0."*Button[More..., ButtonData :> "Limit",
>    Active -> True, ButtonStyle -> "RefGuideLink"]
> Attributes[Limit] = {Listable, Protected}
> Limit[a___] := Null /; (Print[InputForm[limit[a]]]; False)
> Options[Limit] = {Analytic -> False, Assumptions :> $Assumptions,
> Direction -> Automatic}
> 
> Of course
> 
> In[19]:=
> Unprotect[Limit];
> Clear[Limit];
> Protect[Limit];
> 
> In[22]:=
> Information["Limit", LongForm -> True]
> 
> "Limit[expr, x->x0] finds the limiting value of expr when x approaches
> x0."*Button[More..., ButtonData :> "Limit",
>    Active -> True, ButtonStyle -> "RefGuideLink"]
> Attributes[Limit] = {Listable, Protected}
> Options[Limit] = {Analytic -> False, Assumptions :> $Assumptions,
> Direction -> Automatic}
> 
> but the question still remains!
> 
> 


  • Prev by Date: Re: how make function of solution by NDSolve depending
  • Next by Date: Re : Re: Interpolation
  • Previous by thread: Re: question about Protect
  • Next by thread: Re: question about Protect