Mathematica 9 is now available
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: [mg69190] RE: [mg69155] efficient term collection algorithm
  • From: "David Park" <djmp at>
  • Date: Fri, 1 Sep 2006 06:41:31 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


What about trying to extract the denominators and then using the Mathematica
Collect routine?

collectDenominators[expr_] :=
  Module[{work = Expand[expr], factors},
    factors = Union[Denominator /@ List @@ work]^-1;
    Collect[expr, factors]

collectDenominators[(b*i + a*j + c*j)/(i*j)]
(a + c)/i + b/j

David Park
djmp at

From: Blake Laing [mailto:laing at]
To: mathgroup at

Dear Math Group

I wish to combine terms in a expression which share a denominator, such
as in the following simple case:

(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?


Blake Laing
physics grad student
University of Oklahoma

  • Prev by Date: Re: efficient term collection algorithm
  • Next by Date: Re: generalized foldlist problem - part 2
  • Previous by thread: Re: efficient term collection algorithm
  • Next by thread: Re: efficient term collection algorithm