Re: Integrate function defined by numerical integration

*To*: mathgroup at smc.vnet.net*Subject*: [mg124181] Re: Integrate function defined by numerical integration*From*: Hani <hanisantosa at gmail.com>*Date*: Wed, 11 Jan 2012 17:23:43 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*References*: <201112170741.CAA18787@smc.vnet.net> <jckc4s$1ig$1@smc.vnet.net>

On Dec 18 2011, 10:35 am, Bob Hanlon <hanlonr... at gmail.com> wrote: > Since func is defined using numerical techniques, restrict its > definition to numerixal arguments. > > Clear[func] > > func[x_?NumericQ] := > NIntegrate[ > x*Sec[alpha]^2*Exp[-x/Cos[alpha]], > {alpha, -ArcCos[x/2], ArcCos[x/2]}]; > > NIntegrate[func[x], {x, 0.2, 1}] > > 1.02655 > > Bob Hanlon > > > > > > > > On Sat, Dec 17, 2011 at 2:41 AM, Hani <hanisant... at gmail.com> wrote: > > Hello all, I have a problem. Suppose I have a function: > > > func[x_] := NIntegrate[ x*Sec[alpha]^2*Exp[-x/Cos[alpha]], {alpha, - > > ArcCos[x/2], ArcCos[x/2]}]. > > > Basically the argument of the function, x, also appears as boundary of > > integration > > > Now, when I want to do this integral: > > > NIntegrate[func[x], {x, 0.2, 1}] > > > there are error messages: NIntegrate::nlim: alpha = cos^-1(0.5 x) is > > not a valid limit of integration. >> > > > Although in the end, the result appears. Now, how to handle this > > problem? I think in this case, we can get the result because func[x_] > > itself is simple. But actually my func[x_] is much more complicated, > > it contains interpolating function too, and when I do the integral, it > > takes long time without result. Can anyone help me? Thank you Bob