2
$\begingroup$

Trying the code in this answer, in particular the RegionIntersection part, I get, on v10.4.1 under windows, a

Throw::sysexc: Uncaught SystemException returned to top level. Can be caught with Catch[\[Ellipsis], _SystemException]
Out[] = SystemException["MemoryAllocationFailure"]

In particular, this error is given evaluating the following simple code (WARNING: this may hang your system for a while):

DiscretizeRegion@RegionIntersection[
    Sphere[{0, 0, 0}, 1],
    Sphere[{1, 0, 0}, .5]
  ]

Can someone replicate this (thus making it most probably a bug of the last versions of MMA), or is it just me?

$\endgroup$
6
  • $\begingroup$ Don't use floating points DiscretizeRegion@ RegionIntersection[Sphere[{0, 0, 0}, 1], Sphere[{1, 0, 0}, 1/2]] $\endgroup$
    – Feyre
    Commented Sep 4, 2016 at 16:07
  • $\begingroup$ It works for me (MMA 11, Ubuntu 15.10) the first time I run it. The second time, I get Uncaught SystemException returned to top level. Can be caught with Catch[\[Ellipsis], _SystemException].. Not using floats works. $\endgroup$
    – anderstood
    Commented Sep 4, 2016 at 16:08
  • $\begingroup$ @Feyre not using floats works. Still, I'm guessing the system should not be so unstable to crash if floating point numbers are used for the radius, right? Can you replicate the error in that case? $\endgroup$
    – glS
    Commented Sep 4, 2016 at 16:09
  • $\begingroup$ @glS I get the error, but also use 10.4, so I guess it's fixed in 11. $\endgroup$
    – Feyre
    Commented Sep 4, 2016 at 16:10
  • $\begingroup$ I get the exception on both V11.0.0 and V10.4 under Linux Mint 17.3 (each time I run the code) $\endgroup$
    – mikado
    Commented Sep 4, 2016 at 18:07

1 Answer 1

1
$\begingroup$

On a hunch I found Specifying MaxCellMeasure helps.

DiscretizeRegion[
 RegionIntersection[Sphere[{0, 0, 0}, 1], Sphere[{1, 0, 0}, .5]]
 , MaxCellMeasure -> 0.1]

enter image description here

As it is a 2d plot, you need very small MaxCellMeasure for a neat circle:

MaxCellMeasure -> 0.00001

enter image description here

$\endgroup$
2
  • $\begingroup$ This is a good workaround, thanks. I think we can say that this is a bug anyway, so I'll also report it to the wolfram support. $\endgroup$
    – glS
    Commented Sep 4, 2016 at 22:18
  • $\begingroup$ @glS Aye, tis that. $\endgroup$
    – Feyre
    Commented Sep 5, 2016 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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