MathGroup Archive 2001

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

Search the Archive

Re: inum error from NIntegrate?

  • To: mathgroup at
  • Subject: [mg28396] Re: inum error from NIntegrate?
  • From: "Allan Hayes" <hay at>
  • Date: Mon, 16 Apr 2001 03:28:48 -0400 (EDT)
  • References: <9b8p5s$>
  • Sender: owner-wri-mathgroup at

This is not an isolated problem, it also occurs with some other functions,
for example Plot.
The following demonstrates the problem and its solution

lst= {x,x^2};
NIntegrate[{x,x^2}, {x,0,1}]


NIntegrate[lst, {x,0,1}]

        NIntegrate::inum: Integrand {0.5,0.25} is not numerical at {x} =


What happens is that NIntegrate looks at   lst   before it is evaluated
(NIntgegrate has attribute HoldAll), finds that it is not a list and then
works on the assumption that   lst   will become numerical when x is
this is false -- it becomes a *list* of two numbers.
The solution is to make   lst   evaluate before NIntegrates inspects its

NIntegrate[Evaluate[lst], {x,0,1}]


The problem does not arise with Integrate, which evaluates   lst   before
inspecting it.

Integrate[lst, {x,0,1}]

        {1/2, 1/3}

The same kind of problem arises with other functions that hold their
entries, for example Plot: compare



Allan Hayes
Mathematica Training and Consulting
Leicester UK
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Carl Gold" <cgold at> wrote in message
news:9b8p5s$7fj at
> Hi - has anyone gotten an error like this before:
> I am using NIntegrate and get
> NIntegrate[g[t1, t2], {t1, -5 , 5}, {t2, -5 , 5}]
> NIntegrate::"inum": "Integrand \!\({\({0.01831563888873418`}\)}\) is not
> \
> numerical at \!\({t1, t2}\) = \!\({0.`, 0.`}\)."
> But if I evaluate the function:
> g[0, 0]
> \!\({{1\/\[ExponentialE]\^4}}\)
> So the problem is not that the integrand doesn't have a value.
> The documentation on the inum error only discusses a case where you hae
> an undefined parameter in your equation, which is not my situation..
> Any ideas what could be causing this error?
> Thanks for your help if you have any!
> -Carl

  • Prev by Date: Re: Nested Lists
  • Next by Date: Re: Re: Why the Interpolation function cannot make a serious of points be linked smoothly?
  • Previous by thread: Re: make directory command for W2K?
  • Next by thread: MatrixTemplate (Simplification)