Is there any way of extracting a common factor of all terms in a list of symbolic expressions?

For example, in the following list

```
[x^4*cos(x), x^3*cos(x), x^2*cos(x)*sin(x)]
```

such function should return `x^2*cos(x)`

.

1 | initial version |

Is there any way of extracting a common factor of all terms in a list of symbolic expressions?

For example, in the following list

```
[x^4*cos(x), x^3*cos(x), x^2*cos(x)*sin(x)]
```

such function should return `x^2*cos(x)`

.

Is there any way of extracting a common factor of all terms in a list of symbolic expressions?

For example, in the following list

```
[x^4*cos(x), x^3*cos(x), x^2*cos(x)*sin(x)]
```

such function should return `x^2*cos(x)`

. And for

```
[1/x^4*cos(x), 1/x^3*cos(x), 1/x^2*cos(x)*sin(x)]
```

it should return `1/x^2*cos(x)`

.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.