Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Using NIntegrate in a function
Replies: 1   Last Post: Mar 7, 2013 10:47 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
psycho_dad

Posts: 66
Registered: 4/28/07
Re: Using NIntegrate in a function
Posted: Mar 7, 2013 10:47 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.