MathGroup Archive 1994

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

Search the Archive

Small addition to Declare.m

  • To: mathgroup at
  • Subject: [mg302] Small addition to Declare.m
  • From: Steve Trainoff <steve at>
  • Date: Wed, 7 Dec 94 15:45:11 -0800

Hi all, 

Perhaps this is old news, but I was working with Pekka Janhunen's very nice  
package, Declare.m, and I ran across a simplification that it did not perform.

I would like it to simplify Sqrt[a b^2] to Sqrt[a] b for the case of b positive.  
Here is the problem and my solution.

In[1]:= << LocalPackages/Declare.m
{Declare, NewDeclare, NonPositive, RealQ}

In[2]:= Declare[{a,b}, Positive]

In[3]:= Sqrt[a b^2]

Out[3]= Sqrt[a b ]

In[4]:= Unprotect[Power]

Out[4]= {Power}

In[5]:= (y_ x_?RealQ ^n_?EvenQ)^a_?RealQ := y^a Abs[x]^(n a)

In[6]:= Protect[Power]

Out[6]= {Power}

In[7]:= Sqrt[a b^2]

Out[7]= Sqrt[a] b

Insert pithy maxim here...
steve at (NeXT mail)

  • Prev by Date: Mathematica Notebooks on WWW
  • Next by Date: Updates
  • Previous by thread: Mathematica Notebooks on WWW
  • Next by thread: Updates