Re: Problem with NIntegrate -- Monte Carlo
- To: mathgroup at smc.vnet.net
- Subject: [mg39215] Re: Problem with NIntegrate -- Monte Carlo
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 4 Feb 2003 02:21:23 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <b1idic$bjv$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, and preventing the evaluation of ComplicatedF[] for symbolic arguments with ComplicatedF[x_?NumericQ] := Re[NIntegrate[E^(-(I x + y + I)^2), {y, 0, 1}]]; NIntegrate[ComplicatedF[x], {x, 0, 2}, Method -> MonteCarlo] work with out an error message. Regards Jens Alan Lewis wrote: > > I have a rather complicated function that Mathematica can't seem to handle > with > NIntegrate, Method->MonteCarlo. > > This is not my function, but it shows the essence of the problem. > Suppose we have > > ComplicatedF[x_] := Re [NIntegrate [E^(- (I x+y+I)^2), {y,0,1}] ] > > Then, if you try: > > NIntegrate[ComplicatedF[x], {x,0,2}, Method->MonteCarlo] > > Mathematica will complain that the integrand is not numerical. > But of course it is numerical and removing the Method->MonteCarlo option > will generate an answer. > > Now my actual function is quite complicated which is why > I want to try the MonteCarlo method. Any suggestions?