MathGroup Archive 2013

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

Search the Archive

Re: Using NIntegrate in a function


Hi dude,

That's not a serious problem. Just define your function as:
f[a_?NumberQ]:=NIntegrate[Exp[-((a-1/3)^2+1)*x^4],{x,-1,1}]

Notice the ?NumberQ part that tells Math to only evaluate the function when "a" is a number. This will stop the errors from coming up.

Cheers



  • Prev by Date: Re: Issue with the submatrix in mathematica(version 7)
  • Next by Date: Fixed Typo in Code---> Re: updating a simulation within Manipulate.
  • Previous by thread: Re: Using NIntegrate in a function
  • Next by thread: Re: Using NIntegrate in a function