Re: Using NIntegrate in a function
- To: mathgroup at smc.vnet.net
- Subject: [mg130062] Re: Using NIntegrate in a function
- From: psycho_dad <s.nesseris at gmail.com>
- Date: Thu, 7 Mar 2013 22:47:21 -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: <kh9kqs$1qe$1@smc.vnet.net>
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