0

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.

MarcoB
  • 67,153
  • 18
  • 91
  • 189
Aharon Naiman
  • 1,173
  • 6
  • 13
  • Collect? What have you tried so far? – MarcoB May 10 '22 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. – Aharon Naiman May 10 '22 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. – Aharon Naiman May 10 '22 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. – MarcoB May 10 '22 at 21:13
  • 3
    Does the function separate from this answer do what you need? – Carl Woll May 10 '22 at 21:19
  • @CarlWoll, I will look at separate, thank you. – Aharon Naiman May 11 '22 at 14:19

0 Answers0