Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #16482
| From | Yi Wang <tririverwangyi@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Pure functions vs rule based functions inside NIntegrate |
| Date | 2014-01-26 08:05 +0000 |
| Message-ID | <lc2fl5$lnt$1@smc.vnet.net> (permalink) |
| Organization | Time-Warner Telecom |
Hello,
As I was told, only pure functions can be compiled. Also, NIntegrate or NDSolve first compiles a function before doing numerical operations. Thus, I would have expected that using pure functions in NIntegrate or NDSolve could be faster than rule based functions.
However, in tests I didn't find such a difference. For example,
f1[x_, y_] := Sin[Sin[x Sin[y]]];
AbsoluteTiming@NIntegrate[f1[x, y], {x, 0, 100}, {y, 0, 100}]
and
f2 = Sin[Sin[#1 Sin[#2]]] &
AbsoluteTiming@NIntegrate[f2[x, y], {x, 0, 100}, {y, 0, 100}]
takes about the same time. How can I tell if both are compiled, or neither, and why?
Thanks!
Yi
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar
Pure functions vs rule based functions inside NIntegrate Yi Wang <tririverwangyi@gmail.com> - 2014-01-26 08:05 +0000 Re: Pure functions vs rule based functions inside NIntegrate Richard Fateman <fateman@cs.berkeley.edu> - 2014-01-28 11:08 +0000
csiph-web