1
$\begingroup$

Consider the following two symbolic integrations:

int[a_, z_] := 
 HeavisideTheta[-t^2 + r^2 + r0^2 - 2 r*r0* z] LegendreP[a, z]
Table[Integrate[int[a, z], {z, -1, 1}, 
  Assumptions -> {t > 0 && r > 0 && r0 > 0}, 
  GenerateConditions -> True], {a, 0, 3}]

and

int[a_, z_] := 
 HeavisideTheta[-t^2 + r^2 + r0^2 - 2 r*r0* z] LegendreP[a, z]
Table[Integrate[int[a, z], {z, -1, 1}, 
  Assumptions -> {t > 0 && r > 0 && r0 > 0}, 
  GenerateConditions -> False], {a, 0, 3}]

In the first I set GenerateConditions->True in the second False.

The second gives 0 for each a, while the first gives a long result which is (very!) different from 0 (and no conditions btw).

Why is it so? I am using version 10 for Windows

Edit This is the output of the first code:

{(HeavisideTheta[((r + r0 - t) (r + r0 + t))/(r r0)] ((r + r0 - t) (r + r0 + t) - ((r - r0)^2 - t^2) HeavisideTheta[((r - r0)^2 - t^2)/(r r0)]))/(2 r r0), -(((r - r0 - t) (r + r0 - t) (r - r0 + t) (r + r0 + t) HeavisideTheta[((r + r0 - t) (r + r0 + t))/( r r0)] (-1 + HeavisideTheta[((r - r0)^2 - t^2)/(r r0)]))/(8 r^2 r0^2)), -(((r - r0 - t) (r + r0 - t) (r - r0 + t) (r + r0 + t) (r^2 + r0^2 - t^2) HeavisideTheta[((r + r0 - t) (r + r0 + t))/( r r0)] (-1 + HeavisideTheta[((r - r0)^2 - t^2)/(r r0)]))/(16 r^3 r0^3)), -(((r - r0 - t) (r + r0 - t) (r - r0 + t) (r + r0 + t) (5 r^4 + 2 r^2 (3 r0^2 - 5 t^2) + 5 (r0^2 - t^2)^2) HeavisideTheta[((r + r0 - t) (r + r0 + t))/( r r0)] (-1 + HeavisideTheta[((r - r0)^2 - t^2)/(r r0)]))/(128 r^4 r0^4))}

$\endgroup$
7
  • $\begingroup$ What happens when you apply FullSimplify[] to the output of the first snippet? $\endgroup$ – J. M.'s torpor Feb 27 '16 at 13:12
  • $\begingroup$ It returns the input $\endgroup$ – mattiav27 Feb 27 '16 at 13:30
  • $\begingroup$ Nothing in the "long result" changed at all? $\endgroup$ – J. M.'s torpor Feb 27 '16 at 13:31
  • $\begingroup$ no, nothing changes $\endgroup$ – mattiav27 Feb 27 '16 at 13:37
  • $\begingroup$ Try putting your assumptions as the second argument of FullSimplify[]. $\endgroup$ – J. M.'s torpor Feb 27 '16 at 14:20
1
$\begingroup$

Both answers given in the question are correct, consistent with the documentation of Integrate. To see this, determine the value of z for which HeavisideTheta changes in value from 1 to 0.

z0 = z /. Solve[-t^2 + r^2 + r0^2 - 2 r*r0*z == 0, z][[1, 1]]
(* (r^2 + r0^2 - t^2)/(2 r r0) *)

which also can be written as 1 + ((r - r0)^2 - t^2)/(2 r r0). Then, labeling as s the general solution provided in the edit of the question,

FullSimplify[s, z0 < -1]
{0, 0, 0, 0}

According to the Options>GenerateConditions section of Integrate, setting GenerateConditions -> False will "Generate a result without conditions that is valid only for some values of parameters", which we see is indeed the case. For completeness,

FullSimplify[s, z0 > 1]
(* {2, 0, 0, 0} *)

FullSimplify[s, -1 < z0 < 1]
(* {((r + r0 - t) (r + r0 + t))/(2 r r0), 
   ((r - r0 - t) (r + r0 - t) (r - r0 + t) (r + r0 + t))/(8 r^2 r0^2), 
   ((r - r0 - t) (r + r0 - t) (r - r0 + t) (r + r0 + t) (r^2 + r0^2 - t^2))/(16 r^3 r0^3), 
   ((r - r0 - t) (r + r0 - t) (r - r0 + t) (r + r0 + t) (5 r^4 + 2 r^2 (3 r0^2 - 5 t^2) 
       + 5 (r0^2 - t^2)^2))/(128 r^4 r0^4)} *)

An alternative way of looking at this problem is to rewrite int as

int[a_, z_] := HeavisideTheta[z0 - z] LegendreP[a, z] 

Thus, for z0 < -1 int is 0 throughout the range of integration, {z, -1, 1}, so Integrate must yield 0 for all integer a. For z0 > -1, on the other hand, the integrals take the form,

Table[Integrate[LegendreP[a, z] , {z, -1, Min[1, z0]}, Assumptions -> z0 > -1], {a, 0, 3}]
(* {1 + Min[1, (r^2 + r0^2 - t^2)/(2 r r0)], 
    -(1/2) + 1/2 Min[1, (r^2 + r0^2 - t^2)/(2 r r0)]^2, 
    -(1/2) Min[1, (r^2 + r0^2 - t^2)/(2 r r0)] + 1/2 Min[1, (r^2 + r0^2 - t^2)/(2 r r0)]^3,
    1/8 - 3/4 Min[1, (r^2 + r0^2 - t^2)/(2 r r0)]^2 + 
        5/8 Min[1, (r^2 + r0^2 - t^2)/(2 r r0)]^4} *)

equivalent to s for z > -1.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.