Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: efficient term collection algorithm

  • To: mathgroup at
  • Subject: [mg69170] Re: efficient term collection algorithm
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at>
  • Date: Fri, 1 Sep 2006 06:40:14 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <ed68a7$jci$>
  • Sender: owner-wri-mathgroup at

Blake Laing wrote:
> Dear Math Group
> I wish to combine terms in a expression which share a denominator, such 
> as in the following simple case:
> In[1]:=
> a/i+b/j+c/i//.Plus[Times[A_.,Power[denom_,-1]],Times[B_.,Power[denom_,-1]]]:>
>       Factor[Plus[A,B]Power[denom,-1]]//InputForm
> Out[1]//InputForm=
> (a + c)/i + b/j
> The actual expression I am working with contains thousands of terms, and 
> a pairwise algorithm such as this is wholly inadequate. Will one of you 
> please suggest a more efficient way to combine each additive term in a 
> large expression with a shared denominator?

Hi Blake,

You could try the following:

expr = a/i + b/j + c/i;

a + c   b
----- + -
   i     j


  • Prev by Date: How to identify "intersections" between to data sets?
  • Next by Date: ReplaceAll (/.)
  • Previous by thread: Re: efficient term collection algorithm
  • Next by thread: Re: efficient term collection algorithm