# splitting integrand based on variable dependence

For multiple integration, I would like to automatically check whether the integrand can be split up to a product of terms, each dependent on as small a subset of the variables as possible.

E.g., given the variables $$(x,y,z)$$, the integrand: $$\sin(x y) e^\sqrt{z} x^3 z/y$$ would produce the list of: {$$\sin(x y) x^3 / y$$, $$e^\sqrt{z} z$$}.

Sin[x y] E^Sqrt[z] x^3 z/y


It would be nice if it would recognize: $$e^{x+y}$$ as: {$$e^x$$, $$e^y$$}.

For now, I will leave cases requiring sums of the products above, e.g., using the trigonometric identity: $$\sin(x + y) = \sin(x) \cos(y) + \sin(y) \cos(x)$$.

I was thinking from the mathematical standpoint, of attempting differentiation to see which parts depend on which variables. However, perhaps there already exist Mathematica functions which get me in the right direction.

Thank you.

• Collect? What have you tried so far? Commented May 10, 2022 at 20:17
• But Collect is for powers only. How would it handle trigonometric functions, for example? I played around a bit with differentiation, however for that, I would like a tree of the multiplicative terms, in order to start with the largest terms possible, as with my example. Commented May 10, 2022 at 20:29
• I thought to replace, at the top level only, Times with List. Then on each element, check to see if it depends on one variable only (differentiating wrt all other variable produces 0). Elements which depend on more than one variable, trying to break them down further to a product. Commented May 10, 2022 at 20:39
• A start might be GroupBy[List @@ (Sin[x y] E^Sqrt[z] x^3 z/y), Variables], although it produces quite a few more groups than you wanted. But maybe you can re-group separated terms in its output according to your preferences. You could also try GatherBy instead of GroupBy for a simpler list output. Commented May 10, 2022 at 21:13
• Does the function separate from this answer do what you need? Commented May 10, 2022 at 21:19