The following two expressions are identical from a human point of view:
a = Integrate[f[x, y], x, y]
b = Integrate[Integrate[f[x, y], x], y]
The same goes here:
a = Integrate[f[x] + g[x], x]
b = Integrate[f[x], x] + Integrate[g[x], x]
However, Mathematica considers them different and FullSimplify[a - b]
produces nasty no-zero results in both cases. This due to the fact that Mathematica "wraps" the inner integrate in b
into ()
in the first case and then cannot thread +
over Integrate
in the second case.
Apparently there might be some edge cases when the order of integrations is important but I am not interested in those. The function under integral f[x, y]
is a simplification of what's going on and so I cannot rely on its name. The reason why I need that is that I combine several such equations and together they are supposed to produce some conservation law - basically the sum of several of such integrals must come out as exact zero. However, some of them are defined as triple integrals, some as double integrals, some as integrals by x
first and then by y
and some as the other way around (or something like that). I cannot define all of them the same way because I use intermediate pieces for other calculations.
How can I explain to Mathematica that a == b
or, better, convert b
into a
.
In a sense, I need standard associativity and distributivity algebraic rules applied to integrals and the ability to convert an integral over an integral into a multiple integral (up to triple integral), e.g.:
integrate[integrate[a * b[x, y] * c[x], x] - d * e[y], y]
should unwrap into:
a * integrate[b[x, y] * c[x], x, y] - d * integrate[e[y], y]
and so on and so forth. Of course, any of these a
, b
, c
are not just a
, b
, c
but could be some complicated expressions.
Following the advice below, I am fine introducing an integrate
instead of using built in Integrate
until the last moment, except that defining the transformation rules for this integrate
seems elusive.
Thanks.