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


Groups > comp.soft-sys.math.mathematica > #13751

Re: Using NIntegrate in a function

From psycho_dad <s.nesseris@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Using NIntegrate in a function
Date 2013-03-08 03:47 +0000
Message-ID <khbmvr$cd2$1@smc.vnet.net> (permalink)
References <kh9kqs$1qe$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Using NIntegrate in a function michele.castellana@gmail.com - 2013-03-07 08:58 +0000
  Re: Using NIntegrate in a function psycho_dad <s.nesseris@gmail.com> - 2013-03-08 03:47 +0000

csiph-web