Mystery: NIntegrate'ing indeterminate-length integrand!

• To: mathgroup at smc.vnet.net
• Subject: [mg44057] Mystery: NIntegrate'ing indeterminate-length integrand!
• From: frankeye at cox.net (Frank Iannarilli)
• Date: Sun, 19 Oct 2003 01:11:11 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```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"?

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: ask for help on list operation
• Next by Date: Re: Re: Running The Combinatorica GraphEditor
• Previous by thread: PackedArray Bug?
• Next by thread: Re: Mystery: NIntegrate'ing indeterminate-length integrand!