Re: Mystery: NIntegrate'ing indeterminate-length integrand!

• To: mathgroup at smc.vnet.net
• Subject: [mg44077] Re: [mg44057] Mystery: NIntegrate'ing indeterminate-length integrand!
• From: "Peter Pein" <nospam at spam.no>
• Date: Tue, 21 Oct 2003 02:07:51 -0400 (EDT)
• References: <200310190511.BAA08083@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Nintegrate[] decides, at which values for x the integrand is to be evaluated
and passes these values to Sum[]. Simple, isn't it?
If your "Mie-integrand" is discontinuous, try to give NIntegrate the

NIntegrate[
Sum[ Power[x,Power[i,-1]], {i,1,IntegerPart[x]} ],
Evaluate[Prepend[Range[8],x]] ]

Peter Pein, Berlin
petsie at arcAND.de
replace && by || to write to me

----- Original Message -----
From: "Frank Iannarilli" <frankeye at cox.net>
To: mathgroup at smc.vnet.net
Subject: [mg44077] [mg44057] Mystery: NIntegrate'ing indeterminate-length integrand!

> Hi All,
>
>
> Here's a mystery to me: (I split the expression to help visually)
>
>
>   NIntegrate[
> {x,1.,8.}]
>               Sum[ Power[x,Power[i,-1]], {i,1,IntegerPart[x]} ],
>
>
> evaluates successfully (albeit with convergence warning: I got 68.14).
>
>
> My understanding (verified by TracePrint) is that NIntegrate[]
> evaluates the integrand expression, expanding it "all the way down"
> while holding the integration variable (x) unevaluated.  But in the
> above, how can Sum[] know the number of terms to which to expand the
> expression before NIntegrate[] instantiates a numeric value for x?
> Shouldn't things "get stuck"?
>
>
attempting
> to evaluate what I take to be a structurally similar integrand.  To be
> specific, I'm integrating the Mie scattering expression over a range
> of size parameters - the Mie expression itself is a summation of
> terms, with the number of terms (Wiscombe limit) being determined by
> the size parameter (integration variable).
>
> When I evaluate that, the kernel crashes (every time, irregardless of
> integration limits: Mathematica5.0, Win2kPro, P4 512MB RAM).  But I can
> numerically integrate the same expression "by hand", so the expression
> itself is not defective.
>
> Could this "Mie integration" expression simply be expanding, as it is
> evaluated, to such an internal size that the kernel is overwhelmed?
> And how does the first NIntegrate[] above work?
>
>
> Thanks!
>

```

• Prev by Date: Re: Re: recode procedural algorithm to faster functional module
• Next by Date: Re: What Happens to Garbage in Mathematica?
• Previous by thread: Mystery: NIntegrate'ing indeterminate-length integrand!
• Next by thread: Re: Mystery: NIntegrate'ing indeterminate-length integrand!