import%20marimo%0A%0A__generated_with%20%3D%20%220.14.17%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22)%0A%0Awith%20app.setup%3A%0A%20%20%20%20import%20statistics%20as%20stats%0A%20%20%20%20import%20timeit%20as%20tt%0A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20import%20numpy%20as%20np%0A%0A%20%20%20%20from%20min_circle.cvx%20import%20min_circle_cvx%0A%0A%20%20%20%20pos%20%3D%20np.random.randn(2600%2C%202)%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20mo.md(%22%22%22%23%20Problem%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22We%20compute%20the%20radius%20and%20center%20of%20the%20smallest%20enclosing%0A%20%20%20%20%20%20%20%20ball%20for%20%24N%24%20points%20in%20%24d%24%20dimensions.%0A%20%20%20%20%20%20%20%20We%20use%20a%20variety%20of%20tools%20and%20compare%20their%20performance.%0A%20%20%20%20%20%20%20%20For%20fun%20we%20included%20the%20recursive%20algorithm%20by%20Emo%20Welzl.%0A%20%20%20%20%20%20%20%20Hence%20we%20work%20with%20%24d%3D2%24.%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%23%23%20Generate%20a%20cloud%20of%20points%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20%23%20Create%20the%20figure%0A%20%20%20%20from%20min_circle.utils.figure%20import%20create_figure%0A%0A%20%20%20%20fig%20%3D%20create_figure()%0A%20%20%20%20return%20(fig%2C)%0A%0A%0A%40app.cell%0Adef%20_(fig)%3A%0A%20%20%20%20%23%20add%20the%20cloud%20plot%0A%20%20%20%20from%20min_circle.utils.cloud%20import%20Cloud%0A%0A%20%20%20%20cloud%20%3D%20Cloud(points%3Dpos)%0A%0A%20%20%20%20fig.add_trace(cloud.scatter())%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20mo.md(%22%22%22%23%23%20Compute%20with%20cvxpy%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(fig)%3A%0A%20%20%20%20print(min_circle_cvx(points%3Dpos%2C%20solver%3D%22CLARABEL%22))%0A%20%20%20%20circle%20%3D%20min_circle_cvx(points%3Dpos%2C%20solver%3D%22CLARABEL%22)%0A%20%20%20%20fig.add_trace(circle.scatter())%0A%20%20%20%20fig.show()%0A%0A%20%20%20%20def%20cvx1()%3A%0A%20%20%20%20%20%20%20%20min_circle_cvx(points%3Dpos%2C%20solver%3D%22CLARABEL%22)%0A%0A%20%20%20%20%23%20Run%20each%201000%20times%0A%20%20%20%20times_clarabel%20%3D%20tt.repeat(cvx1%2C%20number%3D1%2C%20repeat%3D50)%0A%0A%20%20%20%20print(f%22Implementation%20cvxpy%2Fclarabel%3A%20%7Bstats.mean(times_clarabel)%3A.6f%7D%20seconds%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
7fd4763072f1cbef5010235c88630e02d14b7905c80661557042f911bf27d77f