Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2196 > unrolled thread

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

Started byDrMajorBob <btreat1@austin.rr.com>
First post2011-05-08 11:34 +0000
Last post2011-05-08 11:34 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: How to use NIntegrate to integrate a purely numeric vector function? DrMajorBob <btreat1@austin.rr.com> - 2011-05-08 11:34 +0000

#2196 — Re: How to use NIntegrate to integrate a purely numeric vector function?

FromDrMajorBob <btreat1@austin.rr.com>
Date2011-05-08 11:34 +0000
SubjectRe: How to use NIntegrate to integrate a purely numeric vector function?
Message-ID<iq5v4v$phe$1@smc.vnet.net>
Clear[f]
f[a_?NumericQ] := {a, a*a}
Table[
  Quiet@NIntegrate[f[a][[i]], {a, 2, 3}], {i, 2}]

{2.5, 6.33333}

or

Clear[a]
f = {a, a*a} ;
NIntegrate[f, {a, 2, 3}]

{2.5, 6.33333}

Bobby

On Sat, 07 May 2011 06:33:31 -0500, andre hollstein  
<andre.hollstein@googlemail.com> wrote:

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


-- 
DrMajorBob@yahoo.com

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web