Together, Apart, ?

• To: mathgroup at smc.vnet.net
• Subject: [mg16932] Together, Apart, ?
• From: Arnold Gregory Civ AFRL/SNAT <Gregory.Arnold at sn.wpafb.af.mil>
• Date: Thu, 8 Apr 1999 02:32:37 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```Hello:

I'm still trying to figure out a 'good' way to manipulate some huge
expressions (on the order of 10M leaves)?.  Based on recent suggestions,
I've been using Together instead of Simplify and this has helped
tremendously in many cases.  However, even Together often chugs away for
days on my computer, and I think I have a clue why... it boils down to the
following examples:

Together[(a+b)/(c+d)+(e+f)/(g+h)] // InputForm
Out[82]//InputForm=
(c*e + d*e + c*f + d*f + a*g + b*g + a*h + b*h)/
((c + d)*(g + h))

Apart[(a+b)*(e+f)*(g+h)/(c+d)+(e+f)/(g+h)]  //InputForm
Out[88]//InputForm=
((a + b)*(e + f)*g)/(c + d) + ((a + b)*(e + f)*h)/(c + d) +
(e + f)/(g + h)

These examples are a little hard to read without the pretty printing in
Mathematica.  However, the basic problem is that Mathematica has expanded
the numerator in Together.  I've also considered using Apart, but it also
can end up with more terms than are needed (partially expanded form).
Currently, I'm working with huge ratios of determinant expressions, and
expanding them out is a definite no-no.  I believe the functions can
generally be written as a ratio of polynomials and I'm trying to simplify
the expressions to check things such as if a substitution forces the
equation to zero and to take derivatives and integrals.  From what I can
tell, Together is the fastest code available for forming the ratio of
polynomials... does anybody know of code that does Together without
expanding the numerator?  I've thought about rewriting Together as a list of
rules, but I figured my code would be too simplistic and yet too complex to
be useful.  Any suggestions?  I also thought that Apart might work.  If it
gives me the simplest denominators, then I could multiply them all through
to form the 'together' expression.  Is Apart efficient for huge expressions?
Any suggestions on how to keep Apart from partially expanding the result?