       Re: efficient term collection algorithm

• To: mathgroup at smc.vnet.net
• Subject: [mg69179] Re: efficient term collection algorithm
• From: "sashap" <pavlyk at gmail.com>
• Date: Fri, 1 Sep 2006 06:40:37 -0400 (EDT)
• References: <ed68a7\$jci\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Try using Collect:

In:= e=a/i+b/j+c/i;

In:= Collect[e, i^(-1)]

a + c   b
Out= ----- + -
i     j

Oleksandr Pavlyk
Wolfram Research

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:=
> 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//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?
>
> Thanks,
>
> Blake Laing
> physics grad student
> University of Oklahoma

```

• Prev by Date: Re: efficient term collection algorithm
• Next by Date: Re: Unexpected "Invalid comparison" error when plotting function defined with a Condition pattern
• Previous by thread: Re: efficient term collection algorithm
• Next by thread: Re: efficient term collection algorithm