MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Random points in NIntegrate

  • To: mathgroup at
  • Subject: [mg56452] Re: [mg56425] Random points in NIntegrate
  • From: Andrzej Kozlowski <akoz at>
  • Date: Tue, 26 Apr 2005 01:32:52 -0400 (EDT)
  • References: <>
  • Sender: owner-wri-mathgroup at

On 25 Apr 2005, at 14:30, Ismail T. wrote:

> I need to do the following. I am using mathematica to take a
> multi-dimensional integral with NIntegrate and QuasiMonteCarlo method
> is default for such cases. There are two things that I couldn't figure
> out. First, I want to print the random points that the mathematica
> chooses to take each data points. This is particularly important to
> see whether mathematica is stuck only some parts of the region of
> integration where it assumes that the biggest cntribution comes from.
> Secondly, how can I make mathematica to take sample (random) points
> only in a specific part of the region of integration without applying
> any particular cut to the limits of integration?
> Thanks a lot in advance,
> ismail

1. Here is an example taken form Michael Trott's excellent Mathematica 
Guide Books (where you can even find examples showing find examples 
showing how you can use Mathematica to cook your dinner...)

pointsQMC = Reap[NIntegrate[Exp[-x^2 - 2*y^2 + Sin[x*y]],
       {x, -1, 1}, {y, -1, 1}, Method -> QuasiMonteCarlo,
       Compiled -> False, MaxPoints -> 10^5,
       EvaluationMonitor :> Sow[{x, y}]]][[2,1]];

Show[Graphics[{PointSize[0.003], Point /@ pointsQMC},
    Frame -> True, PlotRange -> {{-1, 1}, {-1, 1}},
    AspectRatio -> Automatic]]

2. I don' think you can directly. But you can split the area over which 
you are integrating into regions and use a different value for 
MaxPoints on each region.

Andrzej Kozlowski
Chiba, Japan

  • Prev by Date: Re: Random points in NIntegrate
  • Next by Date: Re: Working with huge text files with mathematica
  • Previous by thread: Random points in NIntegrate
  • Next by thread: Re: Random points in NIntegrate