Skip to main content
deleted 6 characters in body; edited title
Source Link

A discrepencydiscrepancy between the analytical and numerical integration results

A discrepencydiscrepancy between the analytical and numerical integration results

A discrepency between the analytical and numerical integration results

A discrepancy between the analytical and numerical integration results

Tweeted twitter.com/StackMma/status/968566148395659265
added 1081 characters in body
Source Link
Alexei Boulbitch
  • 40.8k
  • 2
  • 51
  • 102

Let isus integrate the expression:

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.

Let is integrate the expression:

Why? Any ideas?

Let us integrate the expression:

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.

Source Link
Alexei Boulbitch
  • 40.8k
  • 2
  • 51
  • 102

A discrepency between the analytical and numerical integration results

Let is 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?