1
$\begingroup$

I need to evaluate the following integral numerically for different values of a:

NIntegrate[w E^(-w/a)Sin[(w-0.001)100000]/((w-0.001)^2), {w, 0, ∞}]

If I define a small value for a and use the MaxRecursion and AccuracyGoal options I got no error:

a=0.000001
NIntegrate[w E^(-w/a)Sin[(w-0.001)100000]/((w-0.001)^2),
{w, 0, ∞}, MaxRecursion -> 300, AccuracyGoal -> 10]

0.0000374967

But when I increase the value of a with any value for MaxRecursion and AccuracyGoal:

a=0.001
NIntegrate[w E^(-w/a)Sin[(w-0.001)100000]/((w-0.001)^2),
{w, 0, ∞}, MaxRecursion -> 300, AccuracyGoal -> 10]

It gives the error:

Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small

It seems that a lot of questions arose regarding this problem in this community, but I didn't find any concrete solution. I really appropriate if anyone help me out with a solution?

$\endgroup$
  • 1
    $\begingroup$ The integral does not converge because there is a pole of order 1 at w == 0.001. The first NIntegrate, which returns an answer without complaint, is wrong. Now, do you want the Cauchy principal value? (There is also an extra parenthesis in front of Sin[].) $\endgroup$ – Michael E2 Jun 22 '16 at 18:54
  • $\begingroup$ @MichaelE2 Why is it wrong? Yes. I want the principal value. By the way, thanks for the point on extra parenthesis. $\endgroup$ – Farhad Jun 22 '16 at 19:06
  • 1
    $\begingroup$ Actually, I just assumed it was wrong, because the integral diverges and you didn't specify the "PrincipalValue" method. But maybe it was doing the PV behind the scenes anyway. By comparison, I get 6.63412*10^-7 for your first integral by the method in my answer below. $\endgroup$ – Michael E2 Jun 22 '16 at 19:11
0
$\begingroup$

Assuming principal value:

Block[{a = 0.001, w0 = 0.001},
 NIntegrate[
  w E^(-w/a) Sin[(w - w0) 100000]/((w - w0)^2),
  {w, 0, w0, ∞}, MaxRecursion -> 20, AccuracyGoal -> 10, 
  Method -> "PrincipalValue"]
 ]
(*  -0.000052312  *)

Check (seems stable with increased precision):

Block[{a = 0.001 // Rationalize, w0 = 0.001 // Rationalize},
 NIntegrate[w E^(-w/a) Sin[(w - w0) 100000]/((w - w0)^2),
  {w, 0, w0, ∞},
  MaxRecursion -> 20, AccuracyGoal -> 10, WorkingPrecision -> 32, 
  Method -> "PrincipalValue"]
 ]
(*  -0.000052311984060810925124564538411  *)
|improve this answer|||||
$\endgroup$
0
$\begingroup$

I think this integral can be done analytically. I have ignored the 0.001 term as I suspect this is merely intended to improve the numerical behaviour.

Assuming[a > 0, Integrate[w E^(-w/a) Sin[(w) 100000]/((w)^2), {w, 0, Infinity}]]

gives the value

ArcTan[100000 a]
|improve this answer|||||
$\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.