Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #13751
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail |
|---|---|
| From | psycho_dad <s.nesseris@gmail.com> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Using NIntegrate in a function |
| Date | Fri, 8 Mar 2013 03:47:07 +0000 (UTC) |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <khbmvr$cd2$1@smc.vnet.net> (permalink) |
| References | <kh9kqs$1qe$1@smc.vnet.net> |
| Lines | 9 |
| Organization | Time-Warner Telecom |
| NNTP-Posting-Date | 08 Mar 2013 03:47:22 GMT |
| NNTP-Posting-Host | dba40739.news.twtelecom.net |
| X-Trace | DXC=A0@Emik7o:YF`5M@]Oe7e\C_A=>8kQj6]9BHNOcEA\@YcJQB\G[ch7UEFiONJ7[GoV:b>8Ob5gOoS |
| X-Complaints-To | abuse@twtelecom.net |
| Xref | csiph.com comp.soft-sys.math.mathematica:13751 |
Show key headers only | 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
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