MathGroup Archive 2011

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

Search the Archive

How to use NIntegrate to integrate a purely numeric vector function?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118690] How to use NIntegrate to integrate a purely numeric vector function?
  • From: andre hollstein <andre.hollstein at googlemail.com>
  • Date: Sat, 7 May 2011 07:33:31 -0400 (EDT)

Hi Mathgroup, I hope you can help me.
I want to use NIntegrate to integrate a purely numeric vector
function. I simplified this problem to an easy example code. In my
application the function f involves some matrix products with an
InterpolatedFunction object (which is a vector)...

So this is my problem:

Clear[f]
f[a_?NumberQ] := {a, a*a} (*f is returning a list*)
NIntegrate[f[a], {a, 2, 3}]

During evaluation of (Local) In[2569]:= NIntegrate::inum: Integrand
f[a] is not numerical at {a} = {2.00796}. >>
During evaluation of (Local) In[2569]:= NIntegrate::inum: Integrand
f[a] is not numerical at {a} = {2.00796}. >>
Out[2571]= NIntegrate[f[a], {a, 2, 3}]

When f returns a scalar it it working just fine:

Clear[f]
f[a_?NumberQ] := a (*f is returning a scalar*)
NIntegrate[f[a], {a, 2, 3}]
Out[2577]= 2.5

There is hopefully a way to solve this issue...

Thanks, Andr=E9


  • Prev by Date: Re: Converting a list to arguments for a function --- How?
  • Next by Date: Re: Converting a list to arguments for a function --- How?
  • Previous by thread: Problem using a table with Dynamic variables
  • Next by thread: Re: Converting a list to arguments for a function ---