• To: mathgroup at smc.vnet.net
• Subject: [mg75079] question about Protect
• From: "dimitris" <dimmechan at yahoo.com>
• Date: Mon, 16 Apr 2007 20:11:59 -0400 (EDT)

```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: 2007 NKS Summer School
• Next by Date: Re: differentiate a function of a function
• Previous by thread: 2007 NKS Summer School