Re: Sort of nested NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg107224] Re: [mg107176] Sort of nested NIntegrate
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Fri, 5 Feb 2010 07:14:14 -0500 (EST)
- References: <201002050819.DAA06471@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
No problem here: Quit Clear[fu, f, t] fu[x_?NumericQ] := NIntegrate[Cos[x*Sin[t]], {t, 0, 1}] NIntegrate[fu[x]^2, {x, 0, 2}] 1.43171 Plot[fu[x], {x, 0, 2}, PlotRange -> All] Bobby On Fri, 05 Feb 2010 02:19:04 -0600, g.resta at iit.cnr.it <g.resta at iit.cnr.it> wrote: > I have the following little problem with a function defined by means of > NIntegrate. > My function is much more complicated, but the following example suffices. > > Suppose I've defined a function in this way > > fu[x_] := NIntegrate[ Cos[ x * Sin[t] ], {t, 0, 1}]; > > Mathematica can easily compute numerically and plot the function fu. > > Now, I want to use the function fu in another NIntegrate, say > > NIntegrate[ fu[x]^2, {x,0,2}] > > I hoped that was innocuous (maybe slow, since each point of fu require > another > automatic quadrature) but I got instead this error: > NIntegrate::inumr: The integrand Cos[x Sin[t]] has evaluated to non- > numerical values for all sampling points in the region with boundaries > {{0,1}}. > > I also got a number which looks like the right value, but I'm afraid > to trust it because > I do not fully understand the error message. It seems like Mathematica > is trying to do > something symbolic with the guts of fu, even if fu is defined by means > of NIntegrate. > But I'm probably wrong. > > Surely I'm missing something. Can anybody show me the light? > (that is, the right way to perform similar computations, maybe the > right option to pass along?) > > thank you very much, > giovanni > > > -- DrMajorBob at yahoo.com
- References:
- Sort of nested NIntegrate
- From: "g.resta@iit.cnr.it" <g.resta@iit.cnr.it>
- Sort of nested NIntegrate