I have a problem in my code. This code produces two different results when we use GM = {{Sqrt[3.], 0}, {-Sqrt[3], 3}/2} and GM = {{Sqrt[3], 0}, {-Sqrt[3], 3}/2}, where I just use Sqrt[3] instead of Sqrt[3.] in GM. I do not know what happened to this code. Is there any difference between 3 and 3.?
Block[{R = 6, a = 5, GM, Ks, qs, K1s, K2s, ArrowInd, ArrowInd2,
ind, \[Theta] = 2 Pi/3, Q, con2},
GM = {{Sqrt[3.], 0}, {-Sqrt[3], 3}/2};
con2[x_: {_, _}] := N@Norm@x - R > 0.0001;
{K1s, K2s} =
DeleteCases[
Table[# + l.GM, {l,
Tuples[Range[-#, #] &@Ceiling[2 R/3], 2]}] &[{0, # - 1}/2],
k_ /; con2[k]] & /@ {1, -1};
Ks =
Association[
# -> DeleteCases[
Table[# + l.GM, {l,
Tuples[Range[-#, #] &@Ceiling[2 R/3], 2]}] &[{0, # - 1}/
2],
k_ /; con2[k]] & /@ {1, -1}];
ind = AssociationThread[# -> Range@Length@#] &[Join @@ Ks];
qs = RotationMatrix[# 2 \[Pi]/3].{0, -1} & /@ {0, 1, 2};
ArrowInd =
Join @@ Table[
DeleteCases[ind /@ {#, # + q} & /@ Ks[1], {_, _Missing}], {q, qs}];
ArrowInd2 = (Keys@ind)[[#]] & /@ ArrowInd;
Graphics[{{Arrow[#] & /@ ArrowInd2},
{Gray, Dashed, Circle[{0, 0}, 0.5]}, {Gray, Dashed,
Circle[{0, 0}, R]}, {Red, Point[K1s], Blue, Point[K2s]}},
ImageSize -> 240]]