Small addition to Declare.m
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg302] Small addition to Declare.m
- From: Steve Trainoff <steve at tweedledee.ucsb.edu>
- 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]
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
...STeve
------------------------------------
Insert pithy maxim here...
steve at tweedledee.ucsb.edu (NeXT mail)