MathGroup Archive 1999

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

Search the Archive

RE: Re: Together, Apart, ? [2]

  • To: mathgroup at
  • Subject: [mg17102] RE: [mg17042] Re: Together, Apart, ? [2]
  • From: "Ersek, Ted R" <ErsekTR at>
  • Date: Sat, 17 Apr 1999 03:35:03 -0400
  • Sender: owner-wri-mathgroup at

Allan Hayes wrote a very fast and very slick variation of Together.  His
version is shown below:
Here is simple direct version of together that is much faster than the one
in my previous posting - in general recursion is to be avoided .
 ((Plus@@( # List@@expr))/ #)&[Times@@Union[Denominator/@List@@expr]]
SimpleTogether[expr_]:= expr

Union has a SameTest option. Some of the nuances 
of Union and it's option are discussed at:

On that page it says the default test Union uses is stronger than using
Equal or SameQ!  I wonder if there are any situations where you would want
SimpleTogether to use a different setting for the SameTest option in Union.
Thinking there may be situations where you would want this I wrote a version
of Allan's program that uses this option.  Except it isn't "simple" anymore
so I call it MyTogether.  My new version is below.


((Plus@@(# List@@expr))/#)&[Times@@Union[Denominator/@List@@expr,
The built in Together function also has the options 
{Extension->None, Modulus->, Trig->False}. 
Does anyone want to modify the definitions above so it also uses the options
(Extension, Modulus, Trig)?

 Ted Ersek

  • Prev by Date: Re: List of function-heads
  • Next by Date: Stellar Oscillations
  • Previous by thread: Re: Together, Apart, ? [2]
  • Next by thread: Heip! How to draw a graph with log x axis.