## ConstantsGrouping

Simple package for replacing combinations of constants with single constants.

Package provides one function: GroupConstants. To see how it works we first create an example expression:

 expr = (3 c + d + E^(2 x) + 4 π x^2 + 2 a b x z Log[y])/(5 h i x + e y^(5 f g));

Replace combinations of constants with default parameters, treat x and y as variables:

 GroupConstants[expr, {x, y}]
(* {
(E^(2 x) + 4 π x^2 + C[4] + x C[5] Log[y])/(x C[1] + y^C[3] C[2]),
<|C[1] -> 5 h i, C[2] -> e, C[3] -> 5 f g, C[4] -> 3 c + d, C[5] -> 2 a b z|>
} *)

Replace combinations of constants with k<i> symbols, treat only x as a variable:

 GroupConstants[expr, x, GeneratedParameters -> (Symbol["k" <> ToString[#]] &)]
(* {
(E^(2 x) + k3 + k4 x + 4 π x^2)/(k2 + k1 x),
<|k1 -> 5 h i, k2 -> e y^(5 f g), k3 -> 3 c + d, k4 -> 2 a b z Log[y]|>
} *)