Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: question about NIntegrate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128749] Re: question about NIntegrate
  • From: "Nasser M. Abbasi" <nma at 12000.org>
  • Date: Fri, 23 Nov 2012 03:27:13 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k8krhj$83k$1@smc.vnet.net>
  • Reply-to: nma at 12000.org

On 11/22/2012 3:33 AM, dsmirnov90 at gmail.com wrote:
> Hi,

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

do not make the result of f a List. i.e. remove the {}

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

Out[50]= 0.666667

--Nasser



  • Prev by Date: Model fitting
  • Next by Date: Re: simultaneous equation
  • Previous by thread: Re: question about NIntegrate
  • Next by thread: Re: question about NIntegrate