Let us integrate the expression:
I*y*(1/(x - I*y)^(5/2) - 1/(x + I*y)^(5/2))
over a rectangle in the (x,y)
plane, where x varies from -10 to 10, while y varies from 0 to 10. This integral can be solved analytically:
I*Integrate[
y*(1/(x - I*y)^(5/2) - 1/(x + I*y)^(5/2)), {x, -10, 10}, {y, 0, 10}]
% // N
(* -(8/3) Sqrt[5] (2 Sqrt[2] + Sqrt[-1 + 5 Sqrt[2]] - \[Pi] - ArcCosh[3]) *)
(* -2.31 *)
The last line here is the numeric value of the integral that I will use for comparisons below.
Now let us try to solve it numerically with several methods
Quiet[Chop[
I*NIntegrate[
y *(1/(x - I y)^(5/2) - 1/(x + I y)^(5/2)), {x, -10, 10}, {y, 0,
10}, Method -> #]]] & /@ {"LocalAdaptive", \
{"EvenOddSubdivision", Method -> "LocalAdaptive"},
"AdaptiveMonteCarlo", "QuasiMonteCarlo",
"MonteCarlo", {"EvenOddSubdivision",
Method -> "AdaptiveMonteCarlo"}, {"EvenOddSubdivision",
Method -> "DuffyCoordinates"}}
(* {2.16, 2.16, 2.12, 2.26, 1.59, 2.33, 2.18} *)
Some of these methods do not, but some give warnings. I quieted them just to focus on the essential.
What strikes the eye here is that while the result of the exact solution is negative, the numerical result is positive.
Why? Any ideas?
**Edit: **
One can go to the cylindrical coordinates:
expr = Simplify[
TrigToExp[
I*y*(1/(x - I*y)^(5/2) - 1/(x + I*y)^(5/2)) /. {x ->
r*Cos[\[CurlyPhi]], y -> r*Sin[\[CurlyPhi]]}], {r > 0,
0 < \[CurlyPhi] < \[Pi]}]
(* (E^(-((7 I \[CurlyPhi])/
2)) (-1 + E^(2 I \[CurlyPhi])) (-1 + E^(5 I \[CurlyPhi])))/(2 r^(
3/2)) *)
and then integrate. In this case let us integrate it over the upper half-disk with the radius R=10:
Integrate[expr2*r, {r, 0, 10}, {\[CurlyPhi], 0, \[Pi]}] // N
(* 2.41 *)
and numerically
Quiet[NIntegrate[expr2*r, {r, 0, 10}, {\[CurlyPhi], 0, \[Pi]},
Method -> #]] & /@ {"LocalAdaptive", {"EvenOddSubdivision",
Method -> "LocalAdaptive"}, "AdaptiveMonteCarlo",
"QuasiMonteCarlo",
"MonteCarlo", {"EvenOddSubdivision",
Method -> "AdaptiveMonteCarlo"}, {"EvenOddSubdivision",
Method -> "DuffyCoordinates"}}
(* {2.41, 2.41, 2.43, 2.42, 2.28, 2.38, 2.41} *)
In this case they have the same sign.
2.173299654
$\endgroup$f[x_, y_] = y/(x^2 + y^2)^(5/2)*((x + I*y)^(5/2) - (x - I*y)^(5/2))
. However,I*Integrate[f[x, y], {x, -10, 10}, {y, 0, 10}]
returns-(8/3) Sqrt[-5 + 25 Sqrt[2]]
that is approx.-14.69
. Since there is a singularity in $(0,0)$ I guess it might be related to the chosen branches. (That's probably not a problem here but note that the integrals to note commute because of the singularity). $\endgroup$