MathGroup Archive 1999

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

Search the Archive

RE: Canceling square roots with Simplify

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18249] RE: [mg18211] Canceling square roots with Simplify
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Thu, 24 Jun 1999 14:24:27 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

I noticed my solution from a few minutes ago can be improved.  The single
rule below includes all cases (and more) that were covered by my earlier
solution.
 
In[1]:=
MyRule=(zb_^(n_?Negative*z1_.))^z2_:>
 (zb^(-n*z1))^(-z2)


----------------
I apply it to Everett's problem below.

In[2]:=
Sqrt[b^2]*Sqrt[1/b^2]//.MyRule
Out[2]=
1

---------------
Another example:

In[3]:=
example=(((z1^(-z2))^z2)^(-z3))^(-z4)
Out[3]=
(((z1^(-z2))^z2)^(-z3))^(-z4)
 
 
In[4]:=
example//.MyRules
Out[4]=
(((z1^z2)^z2)^z3)^(-z4)
 
---------------------

If you have Version 4.0 you can use the following to make Simplify and
FullSimplify use MyRule automatically.
 
In[5]:=
SetOptions[Simplify,
TransformationFunctions->{Automatic,(#//.MyRule)&}];
SetOptions[FullSimplify,
TransformationFunctions->{Automatic,(#//.MyRule)&}];

----------------
Regards,
Ted Ersek

--------------------

Everett G. Farr  wrote:
-----------------------

Try typing in the following in a new session of Mathematica (I'm currently
running ver 3.0 under WinNT).

Simplify[ Sqrt[b^2]*Sqrt[1/b^2] ]

It seems like the b's should cancel, and I should get 1. Why don't I? Is
there any workaround?

---------------------

Everett,
I think WRI left a needed rule out of the Simplify routine.  Anyway I think
you can say in general that:

((zb^(-z1))^z2
  and
(zb^z1)^(-z2)
  are equal for any (zb,z1,z2).

If I am right the two rules below are worth keeping. They will simplify your
example and *lots* of others.

----------------
In[1]:=
MyRules= {
 ((zb_^(-1*z1_))^(z2_)):>((zb^z1)^(-z2)),
 ((zb_^p_?Negative)^z2_):>(zb^(-p))^(-z2)  };
 
 
In[2]:=
example=(((z1^(-z2))^z2)^(-z3))^(-z4)
Out[2]=
(((z1^(-z2))^z2)^(-z3))^(-z4)
 
 
In[3]:=
example//.MyRules
Out[3]=
(((z1^z2)^z2)^z3)^(-z4)
 
---------------------

If you have Version 4.0 you can use the following to make Simplify and
FullSimplify use MyRules automatically.
 
In[4]:=
SetOptions[Simplify,
TransformationFunctions->{Automatic,(#//.MyRules)&}];
SetOptions[FullSimplify,
TransformationFunctions->{Automatic,(#//.MyRules)&}];

----------------
Regards,
Ted Ersek


  • Prev by Date: Re: Canceling square roots with Simplify
  • Next by Date: CounterBox to different notebook
  • Previous by thread: Re: Canceling square roots with Simplify
  • Next by thread: Re: Canceling square roots with Simplify