MathGroup Archive 2010

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

Search the Archive

Re: Replacement Rule with Sqrt in denominator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114433] Re: Replacement Rule with Sqrt in denominator
  • From: Richard Fateman <fateman at cs.berkeley.edu>
  • Date: Sat, 4 Dec 2010 06:14:00 -0500 (EST)
  • References: <ic5igm$44p$1@smc.vnet.net> <ic8ad7$81f$1@smc.vnet.net> <id7t95$lh1$1@smc.vnet.net> <idagbn$js7$1@smc.vnet.net>

On 12/3/2010 2:21 AM, Richard Fateman wrote:
...
snip
...
I hesitate to follow up on my own posting, but..

Here's a much nicer rule with LCM, that you might like.

qq =  (a_^r_ b_^s_ /; (lcm =
      PolynomialLCM[Denominator[s], Denominator[r]]) =!= 1 :> (a^(
    lcm r) b^(lcm s))^(1/lcm))


although it uses a global variable lcm, which, in a better
formulation might be put inside a module, but I don't know how
this would work inside a pattern in Mathematica.



a^(a_^r_ b_^s_ /; (lcm =
      PolynomialLCM[Denominator[s], Denominator[r]]) =!= 1 :> (a^(
    lcm r) b^(lcm s))^(1/lcm)


a^(r/s)*b^(p/3/s) /. qq

comes out as

(a^(3 r) * b^p)  ^(1/(3 s))

and
Sqrt[u]*Sqrt[v^3]^5 /. qq

comes out as  Sqrt[u*v^15].

Again, that is assuming you want to make that transformation.

Notice the distinct lack of "FullForm" or "Rational"

RJF


  • Prev by Date: Re: Mathematica and Symbolic Manipulation
  • Next by Date: Re: How to get coefficient list from a Series Command
  • Previous by thread: Re: Replacement Rule with Sqrt in denominator
  • Next by thread: Re: Replacement Rule with Sqrt in denominator