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


Groups > comp.soft-sys.math.mathematica > #2192

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

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to use NIntegrate to integrate a purely numeric vector function?
Date 2011-05-08 11:34 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iq5v3l$ph5$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 5/7/11 at 7:33 AM, andre.hollstein@googlemail.com (andre
hollstein) 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}]

<error msg snipped>

>When f returns a scalar it it working just fine:

So, do things this way:

In[1]:= f[a_?NumberQ] := {a, a*a}

In[2]:= NIntegrate[#, {a, 2, 3}] & /@ f[a]

Out[2]= {2.5,6.25}

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: How to use NIntegrate to integrate a purely numeric vector function? Bill Rowe <readnews@sbcglobal.net> - 2011-05-08 11:34 +0000

csiph-web