6
$\begingroup$

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}}
$\endgroup$
1
  • $\begingroup$ A "common factor", where all having it is a given? Intersection @@ list $\endgroup$
    – ciao
    Commented Mar 22, 2014 at 0:49

1 Answer 1

8
$\begingroup$
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}}

*)
$\endgroup$
1
  • 1
    $\begingroup$ Thank you! PolynomialGCD was that function! $\endgroup$ Commented Mar 22, 2014 at 1:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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