MathGroup Archive 2012

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

Search the Archive

Re: question about NIntegrate


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