CITE THIS NOTEBOOK: Find exact circular enclosure of lattice points in PROMYS 2023 by Shenghui Yang. Wolfram Community April 1 2023.
This is a much simpler version of Gauss circle problem proposed in PROMYS 2023, a summer school target to young talents . Use Graphics and Manipulate function we can constructively find and visualize a family of solution which links irrational number and rational number in a very unique way.
Problem
Problem
A lattice point is a point in the plane, both of whose coordinates are integers. It is easy to see that every lattice point can be surrounded by a small circle which excludes all other lattice points from its interior. It is not much harder to see that it is possible to draw a circle which has exactly two lattice points in its interior, or exactly , or exactly , as shown in the picture below.
(x,y)
3
4
Do you think that for every positive integer there is a circle in the plane which contains
exactly lattice points in its interior?
n
exactly
n
Analysis
Analysis
The first idea is that if we put the center of a circle at a lattice point, there is no way we can include, say exact 6 points, because of symmetry. Therefore, we may need to wiggle the circle around a non-lattice point to include points of exact number. Here come two questions:
◼
Is the center fixed?
◼
How to determine the size of the circle with a given center?
For the first one, I just give a try. Assume we have a fixed center {a,b}. If we cannot find such circles with a fixed center, we can find at least two lattice points {x,y} and {u,v} that share the distance to the center. Otherwise, all lattice has unique distance to the center.
In[]:=
SquaredEuclideanDistance[{x,y},{a,b}]==SquaredEuclideanDistance[{u,v},{a,b}]//FullSimplify[#,Assumptions->u∈Integers&&v∈Integers&&x∈Integers&&y∈Integers&&a∈Reals&&b∈Reals]&
Out[]=
2
u
2
v
2
x
2
y
Recall that {x,y,u,v} are all integers. To make x = u and y = v as a unique solution, making and irrational number is a wise choice. For instance
a
b
In[]:=
cen=
2
,3
;(*2
,5
oranyirrationalnumberpairworks*)Say we have two lattice points have the same distance to the chosen center:
In[]:=
SquaredEuclideanDistance[{x,y},cen]==SquaredEuclideanDistance[{u,v},cen]//FullSimplify[#,Assumptions->u∈Integers&&v∈Integers&&x∈Integers&&y∈Integers]&
Out[]=
2+++2
2
u+23
v+2
x
2
y
2
u
2
v
2
x+23
yOr +-+=2. Notice the LHS is integer and RHS can be integer iff and .
2
u
2
v
2
x
2
y
2
(u-x)+22
(y-v)u=x
v=y
In[]:=
Reduce[2+++2
2
u+23
v+2
x
2
y
2
u
2
v
2
x+23
y,{x,y,u,v},Integers]Out[]=
x∈&&y∈&&ux&&vy
Therefore we can find the family of circles enclosing exact given number by choosing a center with irrational coordinates. The corresponding radius to enclose n point is the distance between the chosen center and the n-th nearest lattice point on the plane.
Visualization
Visualization
We sort lattice points by its distance to the chosen center . Let’s also label the nearby lattice by its rank in the sorted distance to.
{
2
,3
}In[]:=
lattice=Flatten[Table[{i,j},{i,-6,8},{j,-5,9}],1];
In[]:=
sortedLattice=SortBy[lattice,N[EuclideanDistance[#,cen]]&][[;;130]];sortedLattice//Short
Out[]//Short=
{{1,2},{2,2},{1,1},{2,1},{1,3},{2,3},{0,2},{0,1},114,{1,8},{4,-4},{2,8},{-4,5},{5,7},{-5,2},{0,8},{-5,1}}
In[]:=
index=Range[sortedLattice//Length];
In[]:=
kvDistRankLattice=AssociationThread[index->sortedLattice];
In[]:=
Graphics{Blue,PointSize[0.015],Point@cen},Red,,
Out[]=
Irrational center introduces randomness, no clear pattern about the connection of the sorted points by their distance to the center .
{
2
,3
}In[]:=
Graphics{{Blue,PointSize[0.015],Point@cen},{Red,Line[sortedLattice]}},
Out[]=
Animation with Manipulate
Animation with Manipulate
If we choose the list of radius as the middle value between the euclidean distance between the chosen center and Nth point and that between the center and (N+1)th point, we find a circle wraps exactly N points inside.
In[]:=
rCandidates=AssociationThread[Most[index]->ListConvolve[{1,1}/2,N@EuclideanDistance[#,cen]&/@sortedLattice]];
Excluding the points outside the “incircle” of the square lattice:
In[]:=
ManipulateGraphics{{Blue,PointSize[0.015],Point@cen},{Blue,PointSize[0.006],Point@(sortedLattice[[;;ind]])},{Red,PointSize[0.006],Point@(sortedLattice[[ind+1;;]])},{Blue,Dashed,Circle[cen,rCandidates[ind]]},{Blue,Text[Style["Exactly "<>ToString[ind]<>" lattice point(s) in circle",15],{1,9}]}},,ImageSize->500,PlotRange->{{-6,8},{-5,9}},{{ind,1,"Index"},Most@index,ControlType->Slider},SaveDefinitions->True
Out[]=
Summary
Summary
◼
Use SortBy to sort lattice points by their distance to the fixed center
◼
Use AssociationThread to create rank-distance data
◼
Use Manipulate to visualize the enclosure of lattice point as the radius grows