I define even permutations as following, but there may be some error. I use it in two different way and get different output.
evenper[x_] := Select[Permutations[x], Signature[#] == 1 &]
Way 1:
evenper[x_] := Select[Permutations[x], Signature[#] == 1 &]
manual=evenper[{a, b, c, d}]
phi = 1.61803398875;
p1 = manual /. {a -> phi, b -> 1, c -> 1/phi, d -> 0};
p2 = manual /. {a -> phi, b -> 1, c -> -1/phi, d -> 0};
p3 = manual /. {a -> phi, b -> -1, c -> 1/phi, d -> 0};
p4 = manual /. {a -> phi, b -> -1, c -> -1/phi, d -> 0};
p5 = manual /. {a -> -phi, b -> 1, c -> 1/phi, d -> 0};
p6 = manual /. {a -> -phi, b -> 1, c -> -1/phi, d -> 0};
p7 = manual /. {a -> -phi, b -> -1, c -> 1/phi, d -> 0};
p8 = manual /. {a -> -phi, b -> -1, c -> -1/phi, d -> 0};
list1=Union[p1, p2, p3, p4, p5, p6, p7, p8]//Sort;
This result is what I want.
Way 2:
evenper[x_] := Select[Permutations[x], Signature[#] == 1 &]
phi = 1.61803398875;
list20 = #*{phi, 1, 1/phi, 0} & /@ (Tuples[{{1, -1}, {1, -1}, {1, -1}, {1}}]);
list2 = Flatten[evenper[#] & /@ list20, 1] // Sort;
But you will find list1 != list2
as following
Position[list1, {-1.618033988749895`, 0, 0.6180339887498948`, -1}]
Position[list2, {-1.618033988749895`, 0, 0.6180339887498948`, -1}]
(*{}*)
(*{{6}}*)
evenper
, but I do not know why. $\endgroup$phi
isphi = GoldenRatio//N;
Also , it is unnecessary to useSort
in the definition oflist1
sinceUnion
already sorts. $\endgroup$