Application Center - Maplesoft

App Preview:

Circle Packing in a Square

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application




Packing Circles in a Square of Minimum Size

Introduction

This application optimizes and visualizes the packing of circles (of varying radii) in a square, such that the side-length of the square is minimized.

 

One solution for 20 circles (with a radius of 1 to 20) is visualized below

This is a difficult global optimization problem and demands strong solvers. This application uses Maple's Global Optimization Toolbox.

 

Circle packing (and packing optimization in general) is characterized by a large optimization space and many constraints; for this application, 20 circles generates 230 constraint equations.

 

The number of circles can be increased to create an increasingly complex problem; Maple automatically generates the symbolic constrain equations.

 

Applications like this are used to stress-test global optimizers.

 

Setup

restart
with(GlobalOptimization)

Number of circles

n := 20:

Radius of circle i is equal to i

for i to n do r[i] := i end do:

Decision Variables and Optimization Bounds

The decision variables are the coordinates (x__i, y__i) of the centers of the circles, and the side length len of the circumscribing square.

vars := [seq(x[i], i = 1 .. n), seq(y[i], i = 1 .. n), len]:

bounds := seq(vars[i] = -500 .. 500, i = 1 .. 2*n), len = 0 .. 500:

Constraints

d__i is the maximum distance from the origin to a point on the circumference of circle i

for i to n do d[i] := r[i]+sqrt(x[i]^2+y[i]^2) end do:

`dist__i,j`
 is the distance between the centers of any two circles minus their radii

for i to n-1 do for j from i+1 to n do dist[i, j] := sqrt((x[i]-x[j])^2+(y[i]-y[j])^2)-r[i]-r[j] end do end do:


The side-length of the square len must be greater than or equal to d__i, for all circles. That is, the maximum distance between the furthest point on a circle's circumference and the origin must be smaller than the side length of the square (assuming the square is positioned on the origin)

cons1 := seq([r[i]+abs(x[i]) <= len, r[i]+abs(y[i]) <= len][], i = 1 .. n):


For circles i and j not to overlap, `dist__i,j` must be zero or greater for all pairs of circles:

cons2 := seq(seq(dist[i, j] >= 0, j = i+1 .. n), i = 1 .. n-1):

Hence the entire set of constraints

cons := {cons1, cons2}

{0 <= ((x[1]-x[2])^2+(y[1]-y[2])^2)^(1/2)-3, 0 <= ((x[1]-x[3])^2+(y[1]-y[3])^2)^(1/2)-4, 0 <= ((x[1]-x[4])^2+(y[1]-y[4])^2)^(1/2)-5, 0 <= ((x[1]-x[5])^2+(y[1]-y[5])^2)^(1/2)-6, 0 <= ((x[1]-x[6])^2+(y[1]-y[6])^2)^(1/2)-7, 0 <= ((x[1]-x[7])^2+(y[1]-y[7])^2)^(1/2)-8, 0 <= ((x[1]-x[8])^2+(y[1]-y[8])^2)^(1/2)-9, 0 <= ((x[1]-x[9])^2+(y[1]-y[9])^2)^(1/2)-10, 0 <= ((x[1]-x[10])^2+(y[1]-y[10])^2)^(1/2)-11, 0 <= ((x[1]-x[11])^2+(y[1]-y[11])^2)^(1/2)-12, 0 <= ((x[1]-x[12])^2+(y[1]-y[12])^2)^(1/2)-13, 0 <= ((x[1]-x[13])^2+(y[1]-y[13])^2)^(1/2)-14, 0 <= ((x[1]-x[14])^2+(y[1]-y[14])^2)^(1/2)-15, 0 <= ((x[1]-x[15])^2+(y[1]-y[15])^2)^(1/2)-16, 0 <= ((x[1]-x[16])^2+(y[1]-y[16])^2)^(1/2)-17, 0 <= ((x[1]-x[17])^2+(y[1]-y[17])^2)^(1/2)-18, 0 <= ((x[1]-x[18])^2+(y[1]-y[18])^2)^(1/2)-19, 0 <= ((x[1]-x[19])^2+(y[1]-y[19])^2)^(1/2)-20, 0 <= ((x[1]-x[20])^2+(y[1]-y[20])^2)^(1/2)-21, 0 <= ((x[2]-x[3])^2+(y[2]-y[3])^2)^(1/2)-5, 0 <= ((x[2]-x[4])^2+(y[2]-y[4])^2)^(1/2)-6, 0 <= ((x[2]-x[5])^2+(y[2]-y[5])^2)^(1/2)-7, 0 <= ((x[2]-x[6])^2+(y[2]-y[6])^2)^(1/2)-8, 0 <= ((x[2]-x[7])^2+(y[2]-y[7])^2)^(1/2)-9, 0 <= ((x[2]-x[8])^2+(y[2]-y[8])^2)^(1/2)-10, 0 <= ((x[2]-x[9])^2+(y[2]-y[9])^2)^(1/2)-11, 0 <= ((x[2]-x[10])^2+(y[2]-y[10])^2)^(1/2)-12, 0 <= ((x[2]-x[11])^2+(y[2]-y[11])^2)^(1/2)-13, 0 <= ((x[2]-x[12])^2+(y[2]-y[12])^2)^(1/2)-14, 0 <= ((x[2]-x[13])^2+(y[2]-y[13])^2)^(1/2)-15, 0 <= ((x[2]-x[14])^2+(y[2]-y[14])^2)^(1/2)-16, 0 <= ((x[2]-x[15])^2+(y[2]-y[15])^2)^(1/2)-17, 0 <= ((x[2]-x[16])^2+(y[2]-y[16])^2)^(1/2)-18, 0 <= ((x[2]-x[17])^2+(y[2]-y[17])^2)^(1/2)-19, 0 <= ((x[2]-x[18])^2+(y[2]-y[18])^2)^(1/2)-20, 0 <= ((x[2]-x[19])^2+(y[2]-y[19])^2)^(1/2)-21, 0 <= ((x[2]-x[20])^2+(y[2]-y[20])^2)^(1/2)-22, 0 <= ((x[3]-x[4])^2+(y[3]-y[4])^2)^(1/2)-7, 0 <= ((x[3]-x[5])^2+(y[3]-y[5])^2)^(1/2)-8, 0 <= ((x[3]-x[6])^2+(y[3]-y[6])^2)^(1/2)-9, 0 <= ((x[3]-x[7])^2+(y[3]-y[7])^2)^(1/2)-10, 0 <= ((x[3]-x[8])^2+(y[3]-y[8])^2)^(1/2)-11, 0 <= ((x[3]-x[9])^2+(y[3]-y[9])^2)^(1/2)-12, 0 <= ((x[3]-x[10])^2+(y[3]-y[10])^2)^(1/2)-13, 0 <= ((x[3]-x[11])^2+(y[3]-y[11])^2)^(1/2)-14, 0 <= ((x[3]-x[12])^2+(y[3]-y[12])^2)^(1/2)-15, 0 <= ((x[3]-x[13])^2+(y[3]-y[13])^2)^(1/2)-16, 0 <= ((x[3]-x[14])^2+(y[3]-y[14])^2)^(1/2)-17, 0 <= ((x[3]-x[15])^2+(y[3]-y[15])^2)^(1/2)-18, 0 <= ((x[3]-x[16])^2+(y[3]-y[16])^2)^(1/2)-19, 0 <= ((x[3]-x[17])^2+(y[3]-y[17])^2)^(1/2)-20, 0 <= ((x[3]-x[18])^2+(y[3]-y[18])^2)^(1/2)-21, 0 <= ((x[3]-x[19])^2+(y[3]-y[19])^2)^(1/2)-22, 0 <= ((x[3]-x[20])^2+(y[3]-y[20])^2)^(1/2)-23, 0 <= ((x[4]-x[5])^2+(y[4]-y[5])^2)^(1/2)-9, 0 <= ((x[4]-x[6])^2+(y[4]-y[6])^2)^(1/2)-10, 0 <= ((x[4]-x[7])^2+(y[4]-y[7])^2)^(1/2)-11, 0 <= ((x[4]-x[8])^2+(y[4]-y[8])^2)^(1/2)-12, 0 <= ((x[4]-x[9])^2+(y[4]-y[9])^2)^(1/2)-13, 0 <= ((x[4]-x[10])^2+(y[4]-y[10])^2)^(1/2)-14, 0 <= ((x[4]-x[11])^2+(y[4]-y[11])^2)^(1/2)-15, 0 <= ((x[4]-x[12])^2+(y[4]-y[12])^2)^(1/2)-16, 0 <= ((x[4]-x[13])^2+(y[4]-y[13])^2)^(1/2)-17, 0 <= ((x[4]-x[14])^2+(y[4]-y[14])^2)^(1/2)-18, 0 <= ((x[4]-x[15])^2+(y[4]-y[15])^2)^(1/2)-19, 0 <= ((x[4]-x[16])^2+(y[4]-y[16])^2)^(1/2)-20, 0 <= ((x[4]-x[17])^2+(y[4]-y[17])^2)^(1/2)-21, 0 <= ((x[4]-x[18])^2+(y[4]-y[18])^2)^(1/2)-22, 0 <= ((x[4]-x[19])^2+(y[4]-y[19])^2)^(1/2)-23, 0 <= ((x[4]-x[20])^2+(y[4]-y[20])^2)^(1/2)-24, 0 <= ((x[5]-x[6])^2+(y[5]-y[6])^2)^(1/2)-11, 0 <= ((x[5]-x[7])^2+(y[5]-y[7])^2)^(1/2)-12, 0 <= ((x[5]-x[8])^2+(y[5]-y[8])^2)^(1/2)-13, 0 <= ((x[5]-x[9])^2+(y[5]-y[9])^2)^(1/2)-14, 0 <= ((x[5]-x[10])^2+(y[5]-y[10])^2)^(1/2)-15, 0 <= ((x[5]-x[11])^2+(y[5]-y[11])^2)^(1/2)-16, 0 <= ((x[5]-x[12])^2+(y[5]-y[12])^2)^(1/2)-17, 0 <= ((x[5]-x[13])^2+(y[5]-y[13])^2)^(1/2)-18, 0 <= ((x[5]-x[14])^2+(y[5]-y[14])^2)^(1/2)-19, 0 <= ((x[5]-x[15])^2+(y[5]-y[15])^2)^(1/2)-20, 0 <= ((x[5]-x[16])^2+(y[5]-y[16])^2)^(1/2)-21, 0 <= ((x[5]-x[17])^2+(y[5]-y[17])^2)^(1/2)-22, 0 <= ((x[5]-x[18])^2+(y[5]-y[18])^2)^(1/2)-23, 0 <= ((x[5]-x[19])^2+(y[5]-y[19])^2)^(1/2)-24, 0 <= ((x[5]-x[20])^2+(y[5]-y[20])^2)^(1/2)-25, 0 <= ((x[6]-x[7])^2+(y[6]-y[7])^2)^(1/2)-13, 0 <= ((x[6]-x[8])^2+(y[6]-y[8])^2)^(1/2)-14, 0 <= ((x[6]-x[9])^2+(y[6]-y[9])^2)^(1/2)-15, 0 <= ((x[6]-x[10])^2+(y[6]-y[10])^2)^(1/2)-16, 0 <= ((x[6]-x[11])^2+(y[6]-y[11])^2)^(1/2)-17, 0 <= ((x[6]-x[12])^2+(y[6]-y[12])^2)^(1/2)-18, 0 <= ((x[6]-x[13])^2+(y[6]-y[13])^2)^(1/2)-19, 0 <= ((x[6]-x[14])^2+(y[6]-y[14])^2)^(1/2)-20, 0 <= ((x[6]-x[15])^2+(y[6]-y[15])^2)^(1/2)-21, 0 <= ((x[6]-x[16])^2+(y[6]-y[16])^2)^(1/2)-22, 0 <= ((x[6]-x[17])^2+(y[6]-y[17])^2)^(1/2)-23, 0 <= ((x[6]-x[18])^2+(y[6]-y[18])^2)^(1/2)-24, 0 <= ((x[6]-x[19])^2+(y[6]-y[19])^2)^(1/2)-25, 0 <= ((x[6]-x[20])^2+(y[6]-y[20])^2)^(1/2)-26, 0 <= ((x[7]-x[8])^2+(y[7]-y[8])^2)^(1/2)-15, 0 <= ((x[7]-x[9])^2+(y[7]-y[9])^2)^(1/2)-16, 0 <= ((x[7]-x[10])^2+(y[7]-y[10])^2)^(1/2)-17, 0 <= ((x[7]-x[11])^2+(y[7]-y[11])^2)^(1/2)-18, 0 <= ((x[7]-x[12])^2+(y[7]-y[12])^2)^(1/2)-19, 0 <= ((x[7]-x[13])^2+(y[7]-y[13])^2)^(1/2)-20, 0 <= ((x[7]-x[14])^2+(y[7]-y[14])^2)^(1/2)-21, 0 <= ((x[7]-x[15])^2+(y[7]-y[15])^2)^(1/2)-22, 0 <= ((x[7]-x[16])^2+(y[7]-y[16])^2)^(1/2)-23, 0 <= ((x[7]-x[17])^2+(y[7]-y[17])^2)^(1/2)-24, 0 <= ((x[7]-x[18])^2+(y[7]-y[18])^2)^(1/2)-25, 0 <= ((x[7]-x[19])^2+(y[7]-y[19])^2)^(1/2)-26, 0 <= ((x[7]-x[20])^2+(y[7]-y[20])^2)^(1/2)-27, 0 <= ((x[8]-x[9])^2+(y[8]-y[9])^2)^(1/2)-17, 0 <= ((x[8]-x[10])^2+(y[8]-y[10])^2)^(1/2)-18, 0 <= ((x[8]-x[11])^2+(y[8]-y[11])^2)^(1/2)-19, 0 <= ((x[8]-x[12])^2+(y[8]-y[12])^2)^(1/2)-20, 0 <= ((x[8]-x[13])^2+(y[8]-y[13])^2)^(1/2)-21, 0 <= ((x[8]-x[14])^2+(y[8]-y[14])^2)^(1/2)-22, 0 <= ((x[8]-x[15])^2+(y[8]-y[15])^2)^(1/2)-23, 0 <= ((x[8]-x[16])^2+(y[8]-y[16])^2)^(1/2)-24, 0 <= ((x[8]-x[17])^2+(y[8]-y[17])^2)^(1/2)-25, 0 <= ((x[8]-x[18])^2+(y[8]-y[18])^2)^(1/2)-26, 0 <= ((x[8]-x[19])^2+(y[8]-y[19])^2)^(1/2)-27, 0 <= ((x[8]-x[20])^2+(y[8]-y[20])^2)^(1/2)-28, 0 <= ((x[9]-x[10])^2+(y[9]-y[10])^2)^(1/2)-19, 0 <= ((x[9]-x[11])^2+(y[9]-y[11])^2)^(1/2)-20, 0 <= ((x[9]-x[12])^2+(y[9]-y[12])^2)^(1/2)-21, 0 <= ((x[9]-x[13])^2+(y[9]-y[13])^2)^(1/2)-22, 0 <= ((x[9]-x[14])^2+(y[9]-y[14])^2)^(1/2)-23, 0 <= ((x[9]-x[15])^2+(y[9]-y[15])^2)^(1/2)-24, 0 <= ((x[9]-x[16])^2+(y[9]-y[16])^2)^(1/2)-25, 0 <= ((x[9]-x[17])^2+(y[9]-y[17])^2)^(1/2)-26, 0 <= ((x[9]-x[18])^2+(y[9]-y[18])^2)^(1/2)-27, 0 <= ((x[9]-x[19])^2+(y[9]-y[19])^2)^(1/2)-28, 0 <= ((x[9]-x[20])^2+(y[9]-y[20])^2)^(1/2)-29, 0 <= ((x[10]-x[11])^2+(y[10]-y[11])^2)^(1/2)-21, 0 <= ((x[10]-x[12])^2+(y[10]-y[12])^2)^(1/2)-22, 0 <= ((x[10]-x[13])^2+(y[10]-y[13])^2)^(1/2)-23, 0 <= ((x[10]-x[14])^2+(y[10]-y[14])^2)^(1/2)-24, 0 <= ((x[10]-x[15])^2+(y[10]-y[15])^2)^(1/2)-25, 0 <= ((x[10]-x[16])^2+(y[10]-y[16])^2)^(1/2)-26, 0 <= ((x[10]-x[17])^2+(y[10]-y[17])^2)^(1/2)-27, 0 <= ((x[10]-x[18])^2+(y[10]-y[18])^2)^(1/2)-28, 0 <= ((x[10]-x[19])^2+(y[10]-y[19])^2)^(1/2)-29, 0 <= ((x[10]-x[20])^2+(y[10]-y[20])^2)^(1/2)-30, 0 <= ((x[11]-x[12])^2+(y[11]-y[12])^2)^(1/2)-23, 0 <= ((x[11]-x[13])^2+(y[11]-y[13])^2)^(1/2)-24, 0 <= ((x[11]-x[14])^2+(y[11]-y[14])^2)^(1/2)-25, 0 <= ((x[11]-x[15])^2+(y[11]-y[15])^2)^(1/2)-26, 0 <= ((x[11]-x[16])^2+(y[11]-y[16])^2)^(1/2)-27, 0 <= ((x[11]-x[17])^2+(y[11]-y[17])^2)^(1/2)-28, 0 <= ((x[11]-x[18])^2+(y[11]-y[18])^2)^(1/2)-29, 0 <= ((x[11]-x[19])^2+(y[11]-y[19])^2)^(1/2)-30, 0 <= ((x[11]-x[20])^2+(y[11]-y[20])^2)^(1/2)-31, 0 <= ((x[12]-x[13])^2+(y[12]-y[13])^2)^(1/2)-25, 0 <= ((x[12]-x[14])^2+(y[12]-y[14])^2)^(1/2)-26, 0 <= ((x[12]-x[15])^2+(y[12]-y[15])^2)^(1/2)-27, 0 <= ((x[12]-x[16])^2+(y[12]-y[16])^2)^(1/2)-28, 0 <= ((x[12]-x[17])^2+(y[12]-y[17])^2)^(1/2)-29, 0 <= ((x[12]-x[18])^2+(y[12]-y[18])^2)^(1/2)-30, 0 <= ((x[12]-x[19])^2+(y[12]-y[19])^2)^(1/2)-31, 0 <= ((x[12]-x[20])^2+(y[12]-y[20])^2)^(1/2)-32, 0 <= ((x[13]-x[14])^2+(y[13]-y[14])^2)^(1/2)-27, 0 <= ((x[13]-x[15])^2+(y[13]-y[15])^2)^(1/2)-28, 0 <= ((x[13]-x[16])^2+(y[13]-y[16])^2)^(1/2)-29, 0 <= ((x[13]-x[17])^2+(y[13]-y[17])^2)^(1/2)-30, 0 <= ((x[13]-x[18])^2+(y[13]-y[18])^2)^(1/2)-31, 0 <= ((x[13]-x[19])^2+(y[13]-y[19])^2)^(1/2)-32, 0 <= ((x[13]-x[20])^2+(y[13]-y[20])^2)^(1/2)-33, 0 <= ((x[14]-x[15])^2+(y[14]-y[15])^2)^(1/2)-29, 0 <= ((x[14]-x[16])^2+(y[14]-y[16])^2)^(1/2)-30, 0 <= ((x[14]-x[17])^2+(y[14]-y[17])^2)^(1/2)-31, 0 <= ((x[14]-x[18])^2+(y[14]-y[18])^2)^(1/2)-32, 0 <= ((x[14]-x[19])^2+(y[14]-y[19])^2)^(1/2)-33, 0 <= ((x[14]-x[20])^2+(y[14]-y[20])^2)^(1/2)-34, 0 <= ((x[15]-x[16])^2+(y[15]-y[16])^2)^(1/2)-31, 0 <= ((x[15]-x[17])^2+(y[15]-y[17])^2)^(1/2)-32, 0 <= ((x[15]-x[18])^2+(y[15]-y[18])^2)^(1/2)-33, 0 <= ((x[15]-x[19])^2+(y[15]-y[19])^2)^(1/2)-34, 0 <= ((x[15]-x[20])^2+(y[15]-y[20])^2)^(1/2)-35, 0 <= ((x[16]-x[17])^2+(y[16]-y[17])^2)^(1/2)-33, 0 <= ((x[16]-x[18])^2+(y[16]-y[18])^2)^(1/2)-34, 0 <= ((x[16]-x[19])^2+(y[16]-y[19])^2)^(1/2)-35, 0 <= ((x[16]-x[20])^2+(y[16]-y[20])^2)^(1/2)-36, 0 <= ((x[17]-x[18])^2+(y[17]-y[18])^2)^(1/2)-35, 0 <= ((x[17]-x[19])^2+(y[17]-y[19])^2)^(1/2)-36, 0 <= ((x[17]-x[20])^2+(y[17]-y[20])^2)^(1/2)-37, 0 <= ((x[18]-x[19])^2+(y[18]-y[19])^2)^(1/2)-37, 0 <= ((x[18]-x[20])^2+(y[18]-y[20])^2)^(1/2)-38, 0 <= ((x[19]-x[20])^2+(y[19]-y[20])^2)^(1/2)-39, 1+abs(x[1]) <= len, 1+abs(y[1]) <= len, 2+abs(x[2]) <= len, 2+abs(y[2]) <= len, 3+abs(x[3]) <= len, 3+abs(y[3]) <= len, 4+abs(x[4]) <= len, 4+abs(y[4]) <= len, 5+abs(x[5]) <= len, 5+abs(y[5]) <= len, 6+abs(x[6]) <= len, 6+abs(y[6]) <= len, 7+abs(x[7]) <= len, 7+abs(y[7]) <= len, 8+abs(x[8]) <= len, 8+abs(y[8]) <= len, 9+abs(x[9]) <= len, 9+abs(y[9]) <= len, 10+abs(x[10]) <= len, 10+abs(y[10]) <= len, 11+abs(x[11]) <= len, 11+abs(y[11]) <= len, 12+abs(x[12]) <= len, 12+abs(y[12]) <= len, 13+abs(x[13]) <= len, 13+abs(y[13]) <= len, 14+abs(x[14]) <= len, 14+abs(y[14]) <= len, 15+abs(x[15]) <= len, 15+abs(y[15]) <= len, 16+abs(x[16]) <= len, 16+abs(y[16]) <= len, 17+abs(x[17]) <= len, 17+abs(y[17]) <= len, 18+abs(x[18]) <= len, 18+abs(y[18]) <= len, 19+abs(x[19]) <= len, 19+abs(y[19]) <= len, 20+abs(x[20]) <= len, 20+abs(y[20]) <= len}

(4.1)

Optimization and Results

numelems(cons)

230

(5.1)

soln := GlobalSolve(len, cons, bounds, timelimit = 15, populationsize = 1000)

[54.7109864321870987, [len = HFloat(54.7109864321871), x[1] = HFloat(51.144265417700225), x[2] = HFloat(-27.5720567183771), x[3] = HFloat(51.7109864321871), x[4] = HFloat(40.948936977977915), x[5] = HFloat(-14.733612458626594), x[6] = HFloat(8.256579573941112), x[7] = HFloat(47.7109864321871), x[8] = HFloat(46.7109864321871), x[9] = HFloat(-45.7109864321871), x[10] = HFloat(-7.352894643918984), x[11] = HFloat(-5.046192483804443), x[12] = HFloat(42.7109864321871), x[13] = HFloat(18.870329002398353), x[14] = HFloat(24.59439232882305), x[15] = HFloat(-26.039118465189453), x[16] = HFloat(4.217443388633547), x[17] = HFloat(-37.7109864321871), x[18] = HFloat(-2.4130427290667384), x[19] = HFloat(35.7109864321871), x[20] = HFloat(-34.7109864321871), y[1] = HFloat(44.19084978776287), y[2] = HFloat(13.901477006415405), y[3] = HFloat(-51.7109864321871), y[4] = HFloat(50.27981180418221), y[5] = HFloat(-48.841114256880495), y[6] = HFloat(25.941111376238574), y[7] = HFloat(-0.3763901791864324), y[8] = HFloat(14.590239367909334), y[9] = HFloat(-45.7109864321871), y[10] = HFloat(22.401038678242635), y[11] = HFloat(43.7109864321871), y[12] = HFloat(34.18615731017476), y[13] = HFloat(41.7109864321871), y[14] = HFloat(14.399753067271712), y[15] = HFloat(-31.96261886767183), y[16] = HFloat(-38.7109864321871), y[17] = HFloat(-2.1671913969844487), y[18] = HFloat(-5.252889475611172), y[19] = HFloat(-23.441515368528023), y[20] = HFloat(34.7109864321871)]]

(5.2)

colorSpread := ColorTools:-EvenSpread("SteelBlue", n)

circs := seq(plottools:-disk([rhs(select(has, soln[2], x[i])[]), rhs(select(has, soln[2], y[i])[])], r[i], color = colorSpread[i], thickness = 2), i = 1 .. n)

boundingCirc := plottools:-rectangle([-rhs(select(has, soln[2], len)[]), rhs(select(has, soln[2], len)[])], [rhs(select(has, soln[2], len)[]), -rhs(select(has, soln[2], len)[])], color = black, thickness = 5, color = "LightGray")

plots:-display(circs, boundingCirc, scaling = constrained, axesfont = [Calibri])

NULL

``