Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: Simplify

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14817] Re: Simplify
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 18 Nov 1998 01:29:21 -0500
  • References: <72jf7e$3h9@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Jurgen Tischer wrote in message <72jf7e$3h9 at smc.vnet.net>...
>Could someone tell me please how to simplify the following formula?
>
>(-7253*2^(1 + 2*n)*5^n - 523*4^n*5^(1 + n) + 17121*20^n +
>    130321*20^n*n^4)/130321
>
>To my surprise when I changed by hand (with two rules) the powers of 2,
>5 and so on to powers of 20, Mathematica changed them back to this
>form.
>
>Thanks
>
>Jurgen
>
>

Jurgen,
 Inspired by Bob Hanlon's solution, which you kindly forwarded to me,
and which I copy below the line  *************, here is solution that
does not need FullSimplify

expr = (-7253*2^(1 + 2*n)*5^n - 523*4^n*5^(1 + n) +
      17121*20^n + 130321*20^n*n^4)/130321;

BasePrines[expr] =
  Union @@ Cases[expr, (k_Integer)^(n_) :>
     First /@ FactorInteger[k], Infinity] {2, 5}

sub = (i = 1; (#1 -> p[i++] & ) /@ %) {2 -> p[1], 5 -> p[2]}

unsub = Reverse /@ sub
{p[1] -> 2, p[2] -> 5}

expr /. {(k_Integer)^(n_) :>
    Times @@
      (FactorInteger[k] /.
        {b_Integer, r_} :> (b /. rules2)^r)^n}

1/130321*(-7253*p[1]^(1 + 2*n)*p[2]^n -
    523*(p[1]^2)^n*p[2]^(1 + n) + 17121*(p[1]^2*p[2])^n +
    130321*n^4*(p[1]^2*p[2])^n)

PowerExpand[%]
1/130321*(17121*p[1]^(2*n)*p[2]^n +
    130321*n^4*p[1]^(2*n)*p[2]^n -
    7253*p[1]^(1 + 2*n)*p[2]^n - 523*p[1]^(2*n)*p[2]^(1 + n) )

Factor[%]
-((p[1]^(2*n)*p[2]^n*(-17121 - 130321*n^4 + 7253*p[1] +
        523*p[2]))/130321)

% /. unsub
2^(2*n)*5^n*n^4

Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

****************************************************************************
****************

BobHanlon at aol.com wrote:
> Jurgen,
>
> I am not convinced that it is hopeless.  You might investigate along these
> lines:
>
> Identify the integers that are raised to powers of n:
>
> baseIntegers[eqn_, n_Symbol:n] :=
>         Cases[eqn, i_Integer^n->i, {1, Infinity}]//Union
>
> Then automate the substitutions given the integers
>
> simplifyMore[eqn_, i1_Integer, i2_Integer, n_Symbol:n] :=
>         Module[{g = GCD[i1, i2], m, eqn2}, If[g==1, eqn,
>                 eqn2 = FullSimplify[FullSimplify[eqn] /.
>                         {i1^n -> m (i1/g)^n, i2^n -> m (i2/g)^n}];
>                 FullSimplify[eqn2 /. m -> g^n]]]
>
> For example
>
> a = (-7253*2^(1 + 2*n)*5^n - 523*4^n*5^(1 + n) + 17121*20^n +
> 130321*20^n*n^4)/130321;
>
> baseIntegers[a]
>
> {4,5,20}
>
> simplifyMore[a, 4, 20]
>
> 20^n*n^4
>
> or
>
> simplifyMore[a, 5, 20]
>
> 20^n*n^4
>
> The liberal use of FullSimplify will tend to make this relatively slow.
>
> Bob Hanlon



  • Prev by Date: Re: A "singular" equation
  • Next by Date: Re: Simplify
  • Previous by thread: RE: Simplify
  • Next by thread: Re: Simplify