Re: Canceling square roots with Simplify

• To: mathgroup at smc.vnet.net
• Subject: [mg18245] Re: [mg18211] Canceling square roots with Simplify
• From: "David Park" <djmp at earthlink.net>
• Date: Thu, 24 Jun 1999 14:24:24 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```>Hello,
>
>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?
>
>Thanks very much
>
>Everett G. Farr
>
>

In Version 4, your can do it this way:

Simplify[ Sqrt[b^2]*Sqrt[1/b^2] , Element[b, Reals]]
1

But since you are using Version 3 you need a rule or function. I have used this
function which puts root expressions together. It is, however, not always safe to
use, just like PowerExpand.

RootsTogether::usage =
"RootsTogether[expr] will put factors involving the same kind of root \
together under one root sign. Like PowerExpand it is not always a permissible \
operation. Mathematica automatically removes number factors from root \
expressions.";

RootsTogether[expr_] := expr //.
{(n_.)*(a_ /;  !NumberQ[a])^(Rational[na_, r_])*
(b_ /;  !NumberQ[b])^(Rational[na_, r_]) ->
n*(a*b)^(Rational[na, r]),
(n_.)*(a_ /;  !NumberQ[a])^(Rational[na_, r_])*
(b_ /;  !NumberQ[b])^(Rational[nb_, r_]) :>
n*(a/b)^(Rational[na, r]) /; na + nb == 0 &&
na > nb, (n_.)*(a_ /;  !NumberQ[a])^
(Rational[na_, r_])*(b_ /;  !NumberQ[b])^
(Rational[nb_, r_]) ->
n*(a^na*b^nb)^(Rational[1, r])}

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

also,

Sqrt[a]/Sqrt[b] // RootsTogether
Sqrt[a/b]

Hope that helps.

David Park