Here is what I came up with to remove a common factor from a vector/list/matrix. It works better than PolynomialGCD.
First I give an example of usage.
f = {((1 + g)*r^(-1 + g))/E^(r*\[Kappa]),
0, (I*r^(-2 + g)*z*\[Alpha])/
E^(r*\[Kappa]), (I*r^(-2 + g)*(x + I*y)*\[Alpha])/E^(r*\[Kappa])};
Print["ORIGINAL f = ", f // MatrixForm];
With[{cf = PolynomialGCD @@ f},
Print["SIMPLIFIED WITH PolynomialGCD: ", cf, " ",
f/cf // MatrixForm]];
PrintRCF["SIMPLIFIED WITH BESPOKE CODE BELOW = ",
RemoveCommonFactor[f], ""];
HERE IS THE OUTPUT

Here is the code
RemoveCommonFactor[myexpr_] :=
Module [{leafcount, atoms, factor, newExpr, Nfactors, depth},
factor = 1;
Nfactors = 0;
newExpr = Simplify[myexpr];
depth = Depth[newExpr];
leafcount = LeafCount[newExpr];
atoms = Union[Flatten[Level[newExpr, 3]]];
Do[
Module[ {atom, temp, lc},
atom = atoms[[i]];
If[! (atom === 0), (
temp = Simplify[newExpr/atom];
lc = LeafCount[temp] + LeafCount[atom] ;
If[lc < LeafCount[newExpr] + 1, (
factor = factor * atom;
Nfactors = Nfactors + 1;
newExpr = temp;
),
null
];
)
];
],
{i, 1, Length[atoms]}
];
{Nfactors, factor, newExpr}
];
PrintRCF[headstr_, rcf_, footstr_] :=
Module[{Nfactors, myfactor, expr},
Nfactors = rcf[[1]];
myfactor = rcf[[2]];
expr = rcf[[3]];
If[Nfactors > 0,
(
Print[headstr, myfactor, " ", expr // MatrixForm, footstr]
),
(
Print[headstr, expr // MatrixForm, footstr];
)
];
Return[null];
];
FullFormin Mathematica. In short, there's just no need to useFullFormin your code. You may want to read the following post: https://mathematica.stackexchange.com/q/3098/1871 Notice the behaviors ofFullFormandMatrixFormare similar here: they just influence the appearance of expression in the notebook. – xzczd Apr 18 '19 at 11:37