Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2162 > unrolled thread
| Started by | andre hollstein <andre.hollstein@googlemail.com> |
|---|---|
| First post | 2011-05-07 11:33 +0000 |
| Last post | 2011-05-09 10:22 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
How to use NIntegrate to integrate a purely numeric vector function? andre hollstein <andre.hollstein@googlemail.com> - 2011-05-07 11:33 +0000
Re: How to use NIntegrate to integrate a purely numeric vector function? Koslicki <koslicki@math.psu.edu> - 2011-05-09 10:22 +0000
| From | andre hollstein <andre.hollstein@googlemail.com> |
|---|---|
| Date | 2011-05-07 11:33 +0000 |
| Subject | How to use NIntegrate to integrate a purely numeric vector function? |
| Message-ID | <iq3am5$fhm$1@smc.vnet.net> |
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
[toc] | [next] | [standalone]
| From | Koslicki <koslicki@math.psu.edu> |
|---|---|
| Date | 2011-05-09 10:22 +0000 |
| Message-ID | <iq8f8d$60v$1@smc.vnet.net> |
| In reply to | #2162 |
Hello,
Since you are integrating a vector-valued function, you simply need to
integrate component-wise. So in your example:
{Integrate[a,{a,2,3}],Integrate[{a*a,{a,2,3}]}
Or more compactly:
Integrate[#,{a,2,3}]&/@{a,a*a}
(Equivalently, replace Integrate[] with NIntegrate[])
Hope this helps,
~David
On May 7, 7:33 am, andre hollstein <andre.hollst...@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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web