Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does there exist a function in Mathematica that simply takes out a common factor from a vector/list of expressions? This seems like such a simple operation that I am surprised that I could not find it in Google or the Mathematica help. It could return the common factor and the list without it:

Function[{a b c , b c, c d}] = {c,{a b, b, d}}

Or it could even simply return the common factor:

Function[{a b c , b c, c d}] = c

edit: sorry I was not completely clear. It would factor out algebraic expression too. So:

Function[{x^2 y, x}]

would yield:

{x,{x y, 1}}
share|improve this question
    
A "common factor", where all having it is a given? Intersection @@ list – ciao Mar 22 '14 at 0:49
up vote 4 down vote accepted
test = {x^2 y, x};

p = PolynomialGCD @@ test
{p, test/p}

test = {a b c e, b c e, c d e, e c};

p = PolynomialGCD @@ test
{p, test/p}

(*

{x, {x y, 1}}
{c e, {a b, b, d, 1}}

*)
share|improve this answer
    
Thank you! PolynomialGCD was that function! – user2686410 Mar 22 '14 at 1:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.