Skip to main content
added 1529 characters in body
Source Link
Alexei Boulbitch
  • 40k
  • 2
  • 48
  • 100

For you first pair of integrals, let us introduce the following rule:

rule = Integrate[Integrate[g_[x, y], {x, -Infinity, Infinity}], {y, -Infinity, 
    Infinity}] :>Integrate[g[x, y], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}];

Then

a = Integrate[
  f[x, y], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}];

b = Integrate[
  Integrate[f[x, y], {x, -Infinity, Infinity}], {y, -Infinity,Infinity}];
b

yields

enter image description here

while

b /. rule

returns the integral without the internal parentheses:

enter image description here

and

a - b /. rule

(*  0  *)

Concerning your second example, one can apply the function Distribute to the first integral:

a = Distribute@Integrate[f[x] + g[x], {x, -Infinity, Infinity}];
b = Integrate[f[x], {x, -Infinity, Infinity}] + 
  Integrate[g[x], {x, -Infinity, Infinity}];
a

returning the following:

enter image description here

Then

a - b

(*  0  *)

Edit To address your question:

To transform the integrals of your last example the rule should be slightly modified to adopt it to the integrals in question:

rule = Integrate[Integrate[Times[g1_[x, y], g2_[x]], x], y] :> 
  Integrate[g1[x, y]*g2[x], x, y];

After that, everything can be done the same way as previously:

expr1=Integrate[Integrate[a*b[x, y]*c[x], x] - d*e[y], y]

    Distribute[expr1] /. rule

enter image description here

A minor note. If you did not previously assign the functions b[x,y], c[x] and so on, it is not necessary to use the lowercase integrate. The expression anyway will not be integrated.

Another story, if you have previously assigned these functions, but want to prevent the integration. It is possible, of course, to use the lowercase integrate as you did in the question.

There is, however, another possibility that I prefer. It is to inactivate the integrals:

expr2 = Inactivate[expr1, Integrate]

The advantage here is that the integrals are shown on the screen in the traditional way. To indicate that they are inactivated they are shown blended. Like this, it is easier to look at the expression. Try it! Then the application of the same procedure:

expr3=Distribute[expr2] /. rule

returns the same result as above. Later, you can activate it, if needed:

expr3//Activate

In general, my experience shows that the rule should be adapted to fit the form of integrals you deal with.

Have fun!

For you first pair of integrals, let us introduce the following rule:

rule = Integrate[Integrate[g_[x, y], {x, -Infinity, Infinity}], {y, -Infinity, 
    Infinity}] :>Integrate[g[x, y], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}];

Then

a = Integrate[
  f[x, y], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}];

b = Integrate[
  Integrate[f[x, y], {x, -Infinity, Infinity}], {y, -Infinity,Infinity}];
b

yields

enter image description here

while

b /. rule

returns the integral without the internal parentheses:

enter image description here

and

a - b /. rule

(*  0  *)

Concerning your second example, one can apply the function Distribute to the first integral:

a = Distribute@Integrate[f[x] + g[x], {x, -Infinity, Infinity}];
b = Integrate[f[x], {x, -Infinity, Infinity}] + 
  Integrate[g[x], {x, -Infinity, Infinity}];
a

returning the following:

enter image description here

Then

a - b

(*  0  *)

Have fun!

For you first pair of integrals, let us introduce the following rule:

rule = Integrate[Integrate[g_[x, y], {x, -Infinity, Infinity}], {y, -Infinity, 
    Infinity}] :>Integrate[g[x, y], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}];

Then

a = Integrate[
  f[x, y], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}];

b = Integrate[
  Integrate[f[x, y], {x, -Infinity, Infinity}], {y, -Infinity,Infinity}];
b

yields

enter image description here

while

b /. rule

returns the integral without the internal parentheses:

enter image description here

and

a - b /. rule

(*  0  *)

Concerning your second example, one can apply the function Distribute to the first integral:

a = Distribute@Integrate[f[x] + g[x], {x, -Infinity, Infinity}];
b = Integrate[f[x], {x, -Infinity, Infinity}] + 
  Integrate[g[x], {x, -Infinity, Infinity}];
a

returning the following:

enter image description here

Then

a - b

(*  0  *)

Edit To address your question:

To transform the integrals of your last example the rule should be slightly modified to adopt it to the integrals in question:

rule = Integrate[Integrate[Times[g1_[x, y], g2_[x]], x], y] :> 
  Integrate[g1[x, y]*g2[x], x, y];

After that, everything can be done the same way as previously:

expr1=Integrate[Integrate[a*b[x, y]*c[x], x] - d*e[y], y]

    Distribute[expr1] /. rule

enter image description here

A minor note. If you did not previously assign the functions b[x,y], c[x] and so on, it is not necessary to use the lowercase integrate. The expression anyway will not be integrated.

Another story, if you have previously assigned these functions, but want to prevent the integration. It is possible, of course, to use the lowercase integrate as you did in the question.

There is, however, another possibility that I prefer. It is to inactivate the integrals:

expr2 = Inactivate[expr1, Integrate]

The advantage here is that the integrals are shown on the screen in the traditional way. To indicate that they are inactivated they are shown blended. Like this, it is easier to look at the expression. Try it! Then the application of the same procedure:

expr3=Distribute[expr2] /. rule

returns the same result as above. Later, you can activate it, if needed:

expr3//Activate

In general, my experience shows that the rule should be adapted to fit the form of integrals you deal with.

Have fun!

Source Link
Alexei Boulbitch
  • 40k
  • 2
  • 48
  • 100

For you first pair of integrals, let us introduce the following rule:

rule = Integrate[Integrate[g_[x, y], {x, -Infinity, Infinity}], {y, -Infinity, 
    Infinity}] :>Integrate[g[x, y], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}];

Then

a = Integrate[
  f[x, y], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}];

b = Integrate[
  Integrate[f[x, y], {x, -Infinity, Infinity}], {y, -Infinity,Infinity}];
b

yields

enter image description here

while

b /. rule

returns the integral without the internal parentheses:

enter image description here

and

a - b /. rule

(*  0  *)

Concerning your second example, one can apply the function Distribute to the first integral:

a = Distribute@Integrate[f[x] + g[x], {x, -Infinity, Infinity}];
b = Integrate[f[x], {x, -Infinity, Infinity}] + 
  Integrate[g[x], {x, -Infinity, Infinity}];
a

returning the following:

enter image description here

Then

a - b

(*  0  *)

Have fun!