I have a list of expressions (they all are exact numeric quantities, not containing any variables), some of them have integer or rationals coefficients, or complex coefficients with rational or integer components. There are no sums of several terms. I am looking for a simple and elegant way to drop those coefficients from all expressions in the list. This is what I wrote so far
ClearAll[normalize];
normalize[0] = 0;
normalize[_?ExactNumberQ] = 1;
normalize[z_Times] := DeleteCases[z, _?ExactNumberQ];
normalize[z_] := z;
normalize /@ {484/45, -16 EulerGamma/3, -8 Log[2], (48/5 + 2 I/5) Sqrt[2] Log[1 + Sqrt[2]]}
(* {1, EulerGamma, Log[2], Sqrt[2] Log[1 + Sqrt[2]]} *)
Could you suggest anything better?
Replace[x, r_?ExactNumberQ :> 1, {0, 1}]
? $\endgroup$Times
head, otherwise it will corrupt terms likePolyGamma[0, 1/Sqrt[2]]
. $\endgroup$