MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NIntegrate and speed

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116796] Re: NIntegrate and speed
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 28 Feb 2011 05:01:31 -0500 (EST)

$Version

"8.0 for Mac OS X x86 (64-bit) (November 6, 2010)"

Clear[R, k]

Assuming[Element[{k, R}, Reals], 
 Integrate[Cos[k R Sin[t]], {t, 0, Pi}]]

Pi*BesselJ[0, Abs[k]*Abs[R]]

R = 8000; Z = 1; rd = 3500;

NIntegrate[Exp[-k Abs[Z]]/(1 + (k rd)^2)^1.5 
  Pi* BesselJ[0, Abs[k]  Abs[R]], {k, 0, Infinity}]

0.000424068

I get the same results with version 7.01.0


Bob Hanlon

---- Marco Masi <marco.masi at ymail.com> wrote: 

=============
I have the following problems with NIntegrate.

1) I would like to make the following double numerical integral converge without errors

R = 8000; Z = 1; rd = 3500;
NIntegrate[Exp[-k Abs[Z]]/(1 + (k rd)^2)^1.5 (NIntegrate[Cos[k R Sin[\[Theta]]], {\[Theta], 0, \[Pi]}]), {k, 0, \[Infinity]}]

It tells non numerical values present and I don't understand why, since it evaluates finally a numerical value? 0.000424067

2) Isn't the second integrand a cylindrical Bessel function of order 0? So, I expected that
NIntegrate[Exp[-k Abs[Z]]/(1 + (k rd)^2)^1.5 BesselJZero[0, k R], {k, 0, \[Infinity]}] doing the same job. But it fails to converge and gives 0.00185584- i4.96939*10^-18. Trying with WorkingPrecision didn't make things better. How can this be fixed?

3) The above Nintegrals will go into a loop and should be evaluated as fast as possible. How? With Compile, CompilationTarget -> "C", Paralleization, etc.?

Any suggestions?

Marco.





  • Prev by Date: Re: Formatting a Cell Programmatically
  • Next by Date: Re: How to local files on ParallelKernels
  • Previous by thread: Re: NIntegrate and speed
  • Next by thread: Re: NIntegrate and speed