2

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?

glS
  • 7,623
  • 1
  • 21
  • 61
  • Don't use floating points DiscretizeRegion@ RegionIntersection[Sphere[{0, 0, 0}, 1], Sphere[{1, 0, 0}, 1/2]] – Feyre Sep 04 '16 at 16:07
  • 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. – anderstood Sep 04 '16 at 16:08
  • @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? – glS Sep 04 '16 at 16:09
  • @glS I get the error, but also use 10.4, so I guess it's fixed in 11. – Feyre Sep 04 '16 at 16:10
  • I get the exception on both V11.0.0 and V10.4 under Linux Mint 17.3 (each time I run the code) – mikado Sep 04 '16 at 18:07
  • I send this to the developers for investigation. – user21 Sep 05 '16 at 13:30

1 Answers1

1

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

Feyre
  • 8,597
  • 2
  • 27
  • 46