Re: NIntegrate and speed

• To: mathgroup at smc.vnet.net
• Subject: [mg116792] Re: NIntegrate and speed
• From: Bill Rowe <readnews at sbcglobal.net>
• Date: Mon, 28 Feb 2011 05:00:48 -0500 (EST)

```On 2/27/11 at 4:35 AM, marco.masi at ymail.com (Marco Masi) 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

You are getting an error since when the inner integral is
initially sampled, k hasn't been assigned a value. You can do
the double integral without the error by doing:

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

Out[3]= 0.000424068

That is, to do a double integral you do not need to type
NIntegrate twice. And by using this syntax, the algorithm being
used can immediately see k is to be assigned numerical values
during the integration.

```

• Prev by Date: Re: Emacs with Mathematica
• Next by Date: Re: Formatting a Cell Programmatically
• Previous by thread: NIntegrate and speed
• Next by thread: Re: NIntegrate and speed