Re: Rearrangement of expression

• To: mathgroup at smc.vnet.net
• Subject: [mg91744] Re: Rearrangement of expression
• From: "David Park" <djmpark at comcast.net>
• Date: Sun, 7 Sep 2008 05:34:34 -0400 (EDT)
• References: <g9t6np\$j9n\$1@smc.vnet.net>

```Manipulating expressions is either fun or a pain in the neck. Let's hope
you'll get enough suggestions to make it fun.

expr = a/Sqrt[a^2 + b^2];

The major difficulty that you throw in is the desired form (b/a)^2.
Mathematica always automatically expands that to b^2/a^2 so we will need a
rule to put it into a HoldForm

powerformat =
Power[x_, n_] Power[y_, m_] /; m == -n \[And] n > 0 ->
HoldForm[(x/y)^n]

Then the easiest solution is:

(expr /. a -> 1 /. b -> b/a) /. powerformat

Sometimes we might consider that substitutions are a bit risky because we
might make a mistake in keeping all the substitutions coordinated. Here is a
more formal calculation approach using a routine, MultiplyByOne, from the
Presentations package.

MultiplyByOne[factor, simplify entire expression, simplify numerator,
simplify denominator]

multiplies the numberator and denominator by the same factor and applies
simplification functions, first to the numerator and denominator, and then
to the entire expression.

Needs["Presentations`Master`"]

expr // MultiplyByOne[1/a, Identity, Identity,
Sqrt[Apart[#^2] /. powerformat] &]

Of course, this manipulation is only correct if a > 0.

{a/Sqrt[a^2 + b^2], 1/Sqrt[1 + b^2/a^2]} /. {{a -> 2}, {a -> -2}}

--
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/

<Gehricht at googlemail.com> wrote in message news:g9t6np\$j9n\$1 at smc.vnet.net...
> Hi!
>
> Suppose I have the fraction a/Sqrt[a^2+b^2]. How can I rearrange it to
> 1/Sqrt[1+(b/a)^2]?
> With thanks
> Yours Wolfgang
>

```

• Prev by Date: Re: Points on a ContourPlot
• Next by Date: Re: Points on a ContourPlot
• Previous by thread: Re: Rearrangement of expression
• Next by thread: Re: Rearrangement of expression