4
$\begingroup$

Bug fixed in 10.2.0


My code is:

Catch[
 NIntegrate[
  1, {x, y} \[Element] Triangle[{{0, 0}, {1, 2}, {2, 1}}], 
  Method -> "MonteCarlo", EvaluationMonitor :> Throw[{x, y}]
 ]
]

After I input it, a window (shown below) is returned:

the memory could not be "written"

My system is Windows 7, 32 bit.

$\endgroup$
  • 4
    $\begingroup$ The kernel shouldn't crash. I've let the appropriate developers know and they will be looking into it. Not sure what the input is intended to do, perhaps something like Reap[NIntegrate[ 1, {x, y} \[Element] Triangle[{{0, 0}, {1, 2}, {2, 1}}], Method -> "MonteCarlo", EvaluationMonitor :> Sow[{x, y}]]] may work? $\endgroup$ – ilian May 13 '15 at 11:19
  • $\begingroup$ @ilian Nice to meet you-WRI engineer.Reap-Sow works normally. But I only want the first random point in this region. $\endgroup$ – WateSoyan May 13 '15 at 12:23
  • $\begingroup$ @ilian I can't translate the Chinese sentence in the window into English. $\endgroup$ – WateSoyan May 13 '15 at 12:31
  • $\begingroup$ I can't translate it either, but I think it is the standard Windows "memory could not be written" crash dialog, e.g. i.stack.imgur.com/U4QK1.jpg The first point sown would be Reap[NIntegrate[...]][[2, 1, 1]]. In other threads, there are also several nice ways to generate random points in a region. $\endgroup$ – ilian May 13 '15 at 20:36
  • $\begingroup$ @ilian Yes,your guess is true,since I find that the meaning of sentences of two windows matches. $\endgroup$ – WateSoyan May 14 '15 at 1:14
7
$\begingroup$

Now fixed in version 10.2.

In[1]:= Catch[NIntegrate[                                                       
      1, {x, y} \[Element] Triangle[{{0, 0}, {1, 2}, {2, 1}}],              
      Method -> "MonteCarlo", EvaluationMonitor :> Throw[{x, y}]]]          

Out[1]= {0.615426, 0.793388}

There is also RandomPoint:

In[2]:= RandomPoint[Triangle[{{0, 0}, {1, 2}, {2, 1}}]]                         

Out[2]= {1.44991, 0.822952}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.