5

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}}
user2686410
  • 347
  • 1
  • 7

1 Answers1

7
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}}

*)
ciao
  • 25,774
  • 2
  • 58
  • 139