Re: compile a numerical integral
- To: mathgroup at smc.vnet.net
- Subject: [mg124564] Re: compile a numerical integral
- From: danl at wolfram.com
- Date: Wed, 25 Jan 2012 07:01:27 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jflvvs$jr4$1@smc.vnet.net>
- Reply-to: comp.soft-sys.math.mathematica at googlegroups.com
This variant seems to work in version 8.
f2 = Compile[{u}, Table[NIntegrate[x*u, {x, 0., j}], {j,{1,2,3}}]]
Your version appears to run without a hitch in version 7 (see below).
In[5]:= f = Compile[{u}, NIntegrate[x*u, {x,0.,#}]& /@ {1,2,3}]
Out[5]= CompiledFunction[{u}, (NIntegrate[x u, {x, 0., #1}] & ) /@ {1, 2, 3},
> -CompiledCode-]
In[6]:= f[1.1]
Out[6]= {0.55, 2.2, 4.95}
So this may indicate a bug in version 8.