MathGroup Archive 2008

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

Search the Archive

Re: Eliminating common factors?

  • To: mathgroup at
  • Subject: [mg93327] Re: Eliminating common factors?
  • From: Bill Rowe <readnews at>
  • Date: Tue, 4 Nov 2008 06:16:17 -0500 (EST)

On 11/3/08 at 5:26 AM, siegman at (AES) wrote:

>I have a simple, totally algebraic symbolic calculation that
>displays its output in the form (rewritten here using TeX notation)

>4 ( {a \over 4 } + { b \over 4 c } )

>where a, b and c are fairly simple products of purely algebraic
>quantities; \over is the TeX notation for a display fraction; and
>the curly brackets are just for TeX purposes and are not there in
>the actual output.

>Is there any Assumption for Simplify, or any other _simple_ way, to
>get rid of those (utterly!!!) superfluous 4's?

The obvious function to use would be Simplify which works here.
That is:

In[1]:= 4 (a/4 + b/(4 c))

Out[1]= 4 (a/4+b/(4 c))

In[2]:= % // Simplify

Out[2]= a+b/c

>[I suppose the real question is, why doesn't M cancel 'em the hell
>out in the first place?!?!]

I would guess this is for performance reasons. For your
particular example, there is no significant performance penalty
for applying Simplify. But for an arbitrary expression, the
performance penalty can be very significant.

Note, there are other ways to have Mathematica eliminate the
common factor. For example,

In[3]:= %% // Expand

Out[3]= a+b/c

And likely the performance penalty for Expand is less than
Simplify. But for an arbitrary expression, Expand could result
in an Expression several lines long which probably is less
useful than the original expression.

However, if you want Mathematica to apply Simplify to all
expressions, simply set $Post to Simplify. For example,

In[4]:= $Post = Simplify;
4 (a/4 + b/(4 c))

Out[5]= a+b/c

  • Prev by Date: Create a cumulative list
  • Next by Date: Trouble solving system of first order, two variable PDEs in
  • Previous by thread: Re: Eliminating common factors?
  • Next by thread: Re: Eliminating common factors?