MathGroup Archive 1999

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

Search the Archive

Re: Canceling square roots with Simplify

>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]]

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 \

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


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

Hope that helps.

David Park
djmp at

  • Prev by Date: Re: Moving average type process
  • Next by Date: plot
  • Previous by thread: Re: Canceling square roots with Simplify
  • Next by thread: RE: Canceling square roots with Simplify