1
$\begingroup$

Good morning, I computed the following integral

Integrate[1/(\[Pi]^3 (I u + y))
I (-1 + 
 t^2) (-(((1 - 6 t^2 + t^4 + 8 t Z - 4 Z^2) ArcTan[(-I + I t^2 + 
    2 t u - 2 u Z)/Sqrt[
   1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
    t^2 (2 - 4 y Z)]])/((-1 + t^2) (1 + t^4 + 4 t^3 y + 4 y Z + 
    4 Z^2 - 4 t (y + 2 Z) + t^2 (2 - 4 y Z))^(3/2)))), u, Assumptions -> u \[Element] Reals && t > -1 && t < 1 && y > -1 && y < 1 && 
Z > 1] // Simplify

the result is

(I (1 - 6 t^2 + t^4 + 8 t Z - 
 4 Z^2) (Log[(
   2 (I u + y) (t - Z))/(-1 + t^2 + 2 t y - 2 y Z - Sqrt[
    1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
     t^2 (2 - 4 y Z)])] Log[(
   1 - t^2 + 2 I t u - 2 I u Z + Sqrt[
    1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
     t^2 (2 - 4 y Z)])/Sqrt[
   1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
    t^2 (2 - 4 y Z)]] - 
 Log[(-1 + t^2 - 2 I t u + 2 I u Z + Sqrt[
    1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
     t^2 (2 - 4 y Z)])/Sqrt[
   1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
    t^2 (2 - 4 y Z)]] Log[(
   2 (I u + y) (t - Z))/(-1 + t^2 + 2 t y - 2 y Z + Sqrt[
    1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
     t^2 (2 - 4 y Z)])] - 
 PolyLog[2, (-1 + t^2 - 2 I t u + 2 I u Z + Sqrt[
   1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
    t^2 (2 - 4 y Z)])/(-1 + t^2 + 2 t y - 2 y Z + Sqrt[
   1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
    t^2 (2 - 4 y Z)])] + 
 PolyLog[2, (
  1 - t^2 + 2 I t u - 2 I u Z + Sqrt[
   1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
    t^2 (2 - 4 y Z)])/(
  1 - t^2 - 2 t y + 2 y Z + Sqrt[
   1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
    t^2 (2 - 4 y Z)])]))/(2 \[Pi]^3 (1 + t^4 + 4 t^3 y + 4 y Z + 
 4 Z^2 - 4 t (y + 2 Z) + t^2 (2 - 4 y Z))^(3/2))

However when i compute a definite integral using this expression and compare to the NIntegrate result i get a different answer. For example:

In[108]:= NIntegrate[(1/(\[Pi]^3 (I u + y))
 I (-1 + 
  t^2) (-(((1 - 6 t^2 + t^4 + 8 t Z - 4 Z^2) ArcTan[(-I + I t^2 + 
     2 t u - 2 u Z)/Sqrt[
    1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
     t^2 (2 - 4 y Z)]])/((-1 + t^2) (1 + t^4 + 4 t^3 y + 4 y Z + 
     4 Z^2 - 4 t (y + 2 Z) + t^2 (2 - 4 y Z))^(3/2))))) /. {t -> 
0.7, y -> 0.25, Z -> 1.7}, {u, -5, 10}] Out[108]= -0.0579211 - 0.000454007 I

whereas

In[109]:= (result /. {u -> 10, t -> 0.7, y -> 0.25, 
Z -> 1.7}) - (result/. {u -> -5, t -> 0.7, y -> 0.25, Z -> 1.7}) Out[109]= -0.080498 - 0.000454007 I

Does anyone know the reason? Thank you for your help

$\endgroup$
5
  • 1
    $\begingroup$ Take a look at Plot[Re[result /. {t -> 7/10, y -> 1/4, Z -> 17/10}], {u, -5, 10}] and you will see a discontinuity at the origin. $\endgroup$
    – user64494
    Jul 8 at 9:17
  • $\begingroup$ Unfortunately, Integrate[ 1/(\[Pi]^3 (I u + y)) I (-1 + t^2) (-(((1 - 6 t^2 + t^4 + 8 t Z - 4 Z^2) ArcTan[(-I + I t^2 + 2 t u - 2 u Z)/ Sqrt[1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + t^2 (2 - 4 y Z)]])/((-1 + t^2) (1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + t^2 (2 - 4 y Z))^(3/2)))), u, Assumptions -> u \[Element] Reals && t > -1 && t < 1 && y > -1 && y < 1 && Z > 1, GenerateConditions -> True] // Simplify produces the same result as yours. $\endgroup$
    – user64494
    Jul 8 at 9:17
  • $\begingroup$ How do you know that it is NIntegrate's result (and not Integrate's) that is wrong? $\endgroup$
    – Szabolcs
    Jul 8 at 9:20
  • $\begingroup$ @Szabolcs If i differentiate result and simplify i get the original integrand, therefore the Integrate result is correct $\endgroup$
    – Andreas
    Jul 8 at 9:36
  • 3
    $\begingroup$ The problem is using the indefinite integration result directly to compute the definite integral. As user64494 points out, it has a discontinuity at 0. This result is correct for both $u<0$ and for $u>0$, and thus suitable for definite integration within those intervals. It will not give the correct results for an interval that contains 0. The NIntegrate result is actually correct. The lesson is that differentiation is not sufficient to check the "correctness" of this type of result, or at least to check its suitability for evaluating definite integrals. $\endgroup$
    – Szabolcs
    Jul 8 at 10:13
0
$\begingroup$

To long for a comment:

MMA version 8.0 gives you an antiderivative that has no discontinuity (here called int1, your solution called int2)

int1 = -(I (1 - 6 t^2 + t^4 + 8 t Z - 4 Z^2) (\[Pi]^2 - 
   4 I \[Pi] ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]] - 
   8 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]]^2 + 
   8 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]] ArcTanh[(1 - t^2 - 2 t y + 2 y Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]] - 
   4 ArcTanh[(1 - t^2 - 2 t y + 2 y Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]]^2 + 
   4 I \[Pi] Log[
     1 + E^(2 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
        1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
         t^2 (2 - 4 y Z)]])] + 
   8 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]] Log[
     1 + E^(2 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
        
        1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
         t^2 (2 - 4 y Z)]])] - 
   8 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]] Log[
     1 - E^(-2 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
         1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
          t^2 (2 - 4 y Z)]] + 
       2 ArcTanh[(1 - t^2 - 2 t y + 2 y Z)/Sqrt[
         1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
          t^2 (2 - 4 y Z)]])] + 
   8 ArcTanh[(1 - t^2 - 2 t y + 2 y Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]] Log[
     1 - E^(-2 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
         1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
          t^2 (2 - 4 y Z)]] + 
       2 ArcTanh[(1 - t^2 - 2 t y + 2 y Z)/Sqrt[
         1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
          t^2 (2 - 4 y Z)]])] + 
   8 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]] Log[1/(
     2 Sqrt[((t - Z) (-I u + t (1 + u^2) - y + t^2 (I u + y) - Z -
          u^2 Z))/(
      1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
       t^2 (2 - 4 y Z))])] - 
   4 I \[Pi] Log[1/
     Sqrt[((t - Z) (-I u + t (1 + u^2) - y + t^2 (I u + y) - Z - 
        u^2 Z))/(
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z))]] - 
   8 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]] Log[1/
     Sqrt[((t - Z) (-I u + t (1 + u^2) - y + t^2 (I u + y) - Z - 
        u^2 Z))/(
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z))]] - 
   8 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]] Log[
     I Sinh[ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
         1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
          t^2 (2 - 4 y Z)]] - 
        ArcTanh[(1 - t^2 - 2 t y + 2 y Z)/Sqrt[
         1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
          t^2 (2 - 4 y Z)]]]] + 
   8 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]] Log[
     2 I Sinh[
       ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
         1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
          t^2 (2 - 4 y Z)]] - 
        ArcTanh[(1 - t^2 - 2 t y + 2 y Z)/Sqrt[
         1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
          t^2 (2 - 4 y Z)]]]] - 
   8 ArcTanh[(1 - t^2 - 2 t y + 2 y Z)/Sqrt[
     1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
      t^2 (2 - 4 y Z)]] Log[
     2 I Sinh[
       ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
         1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
          t^2 (2 - 4 y Z)]] - 
        ArcTanh[(1 - t^2 - 2 t y + 2 y Z)/Sqrt[
         1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
          t^2 (2 - 4 y Z)]]]] + 
   4 PolyLog[
     2, -E^(2 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
        1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
         t^2 (2 - 4 y Z)]])] + 
   4 PolyLog[2, 
     E^(-2 ArcTanh[(1 - t^2 + 2 I t u - 2 I u Z)/Sqrt[
        
        1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
         t^2 (2 - 4 y Z)]] + 
      2 ArcTanh[(1 - t^2 - 2 t y + 2 y Z)/Sqrt[
        1 + t^4 + 4 t^3 y + 4 y Z + 4 Z^2 - 4 t (y + 2 Z) + 
         t^2 (2 - 4 y Z)]])]))/(8 \[Pi]^3 (1 + t^4 + 4 t^3 y + 
  4 y Z + 4 Z^2 - 4 t (y + 2 Z) + t^2 (2 - 4 y Z))^(3/2))

Have a look

Plot[Evaluate[
   Through[{Re, Im}[int1 /. {t -> 0.7, y -> 0.25, Z -> 1.7}]]], {u, -5,
  10}]

Plot[Evaluate[
   Through[{Re, Im}[int2 /. {t -> 0.7, y -> 0.25, Z -> 1.7}]]], {u, -5,
  10}]

Edit

A workaround for your result (my int2) is to subtract the discontinuity at u == zero.

(int2 /. {u -> 10, t -> 0.7, y -> 0.25, Z -> 1.7}) - 
Limit[(int2 /. {t -> 0.7, y -> 0.25, Z -> 1.7}), u -> 0, 
Direction -> -1] + 
Limit[(int2 /. {t -> 0.7, y -> 0.25, Z -> 1.7}), u -> 0, 
Direction -> 1] - (int2 /. {u -> -5, t -> 0.7, y -> 0.25, Z -> 1.7})

(*   -0.0579211 - 0.000454007 I   *)
$\endgroup$
2
  • $\begingroup$ Did you try to evaluate int1 by {t -> 0.7, y -> 0.25, Z -> 1.7,u->10} and by {t -> 0.7, y -> 0.25, Z -> 1.7,u->-5} ? $\endgroup$
    – user64494
    Jul 8 at 12:03
  • $\begingroup$ Of course. Gives the same result as NIntegrate $\endgroup$
    – Akku14
    Jul 8 at 12:06

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