4
$\begingroup$

Here I want to compute this integral using the Mathematica $$\int_0^\infty \int_{-\pi}^{\pi}s^{\frac{1}{2}+2} \exp (-s) \cos \left(\frac{f}{2}\right) \exp (-i k s) \exp \left(-\frac{\sqrt{8 s u}}{\cos \left(\frac{f}{2}\right)}\right)\; df\, ds$$

For simplicity, I use $w$ as the upper limit of the integral with respect to $s$.

Thus, we have the following code by Mathematica:

Gamm[k_, u_] :=2/(15*Sqrt[Pi])*
  NIntegrate[Exp[-I*k*s]*s^(1/2+2)*
    Exp[-s]*Cos[f/2]*Exp[-Sqrt[8*s*u]/Cos[f/2]],
  {f, -Pi, Pi}, {s, 0, w}];
Table[Gamm[0, u], {u, 0, 0.1, 0.001}]

IF I choose w = 10, Mathematica gives:

Table[Gamm[0, u], {u, 0, 0.1, 0.001}]
(*  {0.99443, 0.789459, 0.722113, 0.675455, 0.639067, 0.609022,
     0.58335, 0.560903, 0.540948, 0.522983, 0.506647}  *)

When I choose w = 10^6, the above integral yields

Table[Gamm[0, u], {u, 0, 0.1, 0.001}]
(*  {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}  *)

Clearly, the integral is not zero. How to solve this problem? It seems that there is something wrong.

Any suggestion is helpful! Thanks!

$\endgroup$
  • $\begingroup$ If the question is no clear, please give me a comment. $\endgroup$ – Blueka Jul 12 at 9:28
  • $\begingroup$ Your code dosen't work for me ? $\endgroup$ – Mariusz Iwaniuk Jul 12 at 9:38
  • 1
    $\begingroup$ You need spaces between variables: su should be s u and Iks should be I k s etc. $\endgroup$ – Roman Jul 12 at 9:38
  • 2
    $\begingroup$ Don't you get error messages for w = 10^6? How did you address them? Why are they mentioned in the question? $\endgroup$ – Michael E2 Jul 12 at 13:26
  • 1
    $\begingroup$ I am not sure whether it is a Riemann integral or not. But our work is related to fractional derivatives. @niloderoock $\endgroup$ – Blueka Jul 12 at 13:45
3
$\begingroup$

The following problem is hidden by NIntegrate, but which is one of the common sources of the NIntegrate::izero message you get from the OP's code.

Exp[-I*k*s]*s^(1/2 + 2)*Exp[-s]*Cos[f/2]*
   Exp[-Sqrt[8*s*u]/Cos[f/2]] /.
 {k -> 0, u -> 0.1} /. {f -> 1., s -> 1000.}

General::munfl: Exp[-1032.23] is too small to represent as a normalized machine number; precision may be lost.

(*  0.  *)

Tip: You should make some sort of exploration of the integrand when a numerical integral misbehaves. The two first things would be to evaluate it at a typical point in the integration region and to plot it (if possible, i.e., if it's a single- or two-variable function).

Gamm[k_, u_] := 
  2/(15*Sqrt[Pi])*
   NIntegrate[
    Exp[-I*k*s]*s^(1/2 + 2)*Exp[-s]*Cos[f/2]*
     Exp[-Sqrt[8*s*u]/Cos[f/2]], {f, -Pi, Pi}, {s, 0, w}, 
    PrecisionGoal -> 8, WorkingPrecision -> 32];

Block[{w = 10^6},
 Table[Gamm[0, u], {u, 0, 1/10, 1/100}]
 ]

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

NIntegrate::slwcon: ....

(*
  {1.0000000000626411805661509309408, 
   0.50827294088807703485723248346197, 
   ...
   0.16444683406465457205578964022320, 
   0.15112873347891652231157354357054}
*)

The message is just a warning.

I'm not sure why the integral in TeX in the OP is not the integral being coded:

Block[{w = Infinity},
 Table[Gamm[0, u], {u, 0, 1/10, 1/100}]
 ]
(*
  {0.99999999998679967008116173695908,
   0.50827294069524647486336322647360, 
   ...
   0.16444683409559630424360181571660,
   0.15112873348047743265847037936301}
*)
| 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.