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


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

Re: question about NIntegrate

Started byBob Hanlon <hanlonr357@gmail.com>
First post2012-11-23 08:31 +0000
Last post2012-11-23 08:31 +0000
Articles 1 — 1 participant

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: question about NIntegrate Bob Hanlon <hanlonr357@gmail.com> - 2012-11-23 08:31 +0000

#12429 — Re: question about NIntegrate

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-11-23 08:31 +0000
SubjectRe: question about NIntegrate
Message-ID<k8nc88$dha$1@smc.vnet.net>
Try it without the NumericQ

Clear[f]
f[a_] := {a^2};
NIntegrate[f[x], {x, -1, 1}]

{0.666667}

NIntegrate[#, {x, -1, 1}] & /@ f[x]

{0.666667}

Integrate[f[x], {x, -1, 1}]

{2/3}


Bob Hanlon


On Thu, Nov 22, 2012 at 4:33 AM,  <dsmirnov90@gmail.com> wrote:
> Hi,
>
> I want to use function NIntegrate to integrate a rather complicated function which should be calculated numerically and returns a Table. However, when I write something of the kind:
>
> Clear[f]
> f[(a_)?NumericQ] := {a^2};
> NIntegrate[f[x], {x, -1, 1}]
>
> I get an error: "Integrand f[x] is not numerical at {x} = {-0.984085}"
>
> Strangely, the following code works fine:
>
> NIntegrate[f[1], {x, -1, 1}]
>
> giving the result {2.}
>
> What am I doing wrong?
>
> Dmitry
>

[toc] | [standalone]


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


csiph-web