I want to find a circle with a center and a radius that includes all given points, like a circumscribed circle for the points.

points data: https://www.dropbox.com/s/0unlv1vbngopu38/new_ref.txt?dl=0

The code I thought was as it follows:

Minimize[{r, And @@ (Element[#, Disk[{x, y}, r]] & /@ points)}, {x, y}]

I expected it returned a radius r as a minimum value and {x, y} as a point at which the minimum value is taken.

Mathematica, however, did not calculate it.

Although I also tried with NMinimize, it returned an error message: The constraints are not valid. Constraints should be equalities, inequalities, or domain specifications involving the variables.

Does anyone know what is wrong with my code? How to refine it?

Any comment would be grateful.


1 Answer 1


Not a solution based on Minimize but there are built-in functions to do this.

pts = ReadList["C:/new_ref.txt", {Number, Number}];
reg = BoundingRegion[pts, "MinDisk"]

Disk[{543.071, 542.47}, 450.549]

 , Epilog -> {Black, Point@pts, Red, AbsolutePointSize[6], 
 , Frame -> True

enter image description here


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.