MathGroup Archive 2003

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44069] Re: Mystery: NIntegrate'ing indeterminate-length integrand!
  • From: bobhanlon at aol.com (Bob Hanlon)
  • Date: Mon, 20 Oct 2003 01:13:39 -0400 (EDT)
  • References: <bmt8pu$892$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

You might want to try a piecewise definition such as the following

Integrate[
    Sum[(UnitStep[x-k]-UnitStep[x-k-1])*Sum[Power[x,Power[i,-1]],{i,1,k}],{k,
        8}],{x,1,8}]//Simplify

87/2 + 7*2^(3/7) + (1364*Sqrt[2])/105 + (20*2^(3/5))/3 + 
  (32*2^(3/4))/5 - (9*3^(1/3))/4 - (25*5^(1/5))/6 - 
  (36*6^(1/6))/7 - (49*7^(1/7))/8

%//N

68.1464


Bob Hanlon

In article <bmt8pu$892$1 at smc.vnet.net>, frankeye at cox.net (Frank Iannarilli)
wrote:

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


The reason I'm wondering about this is Mathematica is crashing on 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?


  • Prev by Date: Re: Integrate with piecewise function
  • Next by Date: Re: Re: Re: Running The Combinatorica GraphEditor
  • Previous by thread: Re: Mystery: NIntegrate'ing indeterminate-length integrand!
  • Next by thread: DataSmoothing problem