Function Repository Resource:

KroneckerPoint

Source Notebook

Get a quasirandom point based on Kronecker sequences

Contributed by: Ed Pegg Jr

ResourceFunction["KroneckerPoint"][n]

return , where ρ is the plastic constant.

ResourceFunction["KroneckerPoint"][dim,n]

return where x is a real solution of xdim+1=x+1.

Details

The golden ratio is the real solution for ϕ2=ϕ+1, ϕ≈1.61803398874989.
The plastic ratio is the real solution for ρ3=ρ+1, ρ≈1.32471795724475.
The plastic sequence is a 2D quasirandom sequence (also called a low-discrepancy sequence).

Examples

Basic Examples (3) 

Generate the first point:

In[1]:=
ResourceFunction["KroneckerPoint"][1]
Out[1]=

Numeric approximation of the first three points:

In[2]:=
N[ResourceFunction["KroneckerPoint"][Range[3]]]
Out[2]=

The first three points with ρ (rho) as the plastic constant:

In[3]:=
ResourceFunction["KroneckerPoint"][Range[3]] /. Root[-1 - # + #^3& , 1, 0] -> \[Rho]
Out[3]=

Scope (3) 

In[4]:=
ListPlot[
 Flatten[ResourceFunction["KroneckerPoint"][1, Range[2^6 - 1]]]]
Out[4]=

Show the structure of the plastic quasirandom sequence:

In[5]:=
ListPlot[ResourceFunction["KroneckerPoint"][2, Range[2^10 - 1]], AspectRatio -> 1, PlotStyle -> PointSize[Medium]]
Out[5]=

The first 500 points as Voronoi cells:

In[6]:=
VoronoiMesh[
 ResourceFunction["KroneckerPoint"][Range[500]], {{0, 1}, {0, 1}}]
Out[6]=

Show the dimension 3 points:

In[7]:=
Graphics3D[
 Point[ResourceFunction["KroneckerPoint"][3, Range[2^10 - 1]]]]
Out[7]=

Neat Examples (1) 

The plastic sequence can be folded into a triangle and still be a low-discrepancy sequence:

In[8]:=
Manipulate[
 Graphics[
  Point /@ (If[fold && Total[#] > 1, 1 - #, #] & /@ ResourceFunction["KroneckerPoint"][Range[k]])], {{k, 400, "points"}, 10, 2000, 1, Appearance -> "Labeled"}, {{fold, True}, {True, False}}, SaveDefinitions -> True]
Out[8]=

Version History

  • 1.0.0 – 02 December 2022

Related Resources

License Information