2
$\begingroup$

I am writing some straightforward code to find the structure constants of $\mathfrak{su}(3)$ and experienced a weird result when using the position function to ask which positions had specific values. Here is my code

SU3BASIS = {{{0, 1/2, 0}, {1/2, 0, 0}, {0, 0, 0}}, {{0, -(I/2), 0}, {I/2, 0, 
   0}, {0, 0, 0}}, {{1/2, 0, 0}, {0, -(1/2), 0}, {0, 0, 0}}, {{0, 0, 
   1/2}, {0, 0, 0}, {1/2, 0, 0}}, {{0, 0, -(I/2)}, {0, 0, 0}, {I/2, 0,
    0}}, {{0, 0, 0}, {0, 0, 1/2}, {0, 1/2, 0}}, {{0, 0, 0}, {0, 
   0, -(I/2)}, {0, I/2, 0}}, {{1/(2 Sqrt[3]), 0, 0}, {0, 1/(
   2 Sqrt[3]), 0}, {0, 0, -(1/Sqrt[3])}}};
comm = Table[
   SU3BASIS[[i]] . SU3BASIS[[j]] - SU3BASIS[[j]] . SU3BASIS[[i]], {i, 1, 
    8}, {j, 1, 8}];
struct = Table[-2*I*Tr[comm[[i, j]] . SU3BASIS[[k]]], {i, 1, 8}, {j, 1, 
    8}, {k, 1, 8}];

pos1 = Position[struct, _?(# == -Sqrt[3]/2 &)]

{{4, 8, 5}, {5, 4, 8}, {6, 8, 7}, {7, 6, 8}, {8, 5, 4}, {8, 7, 6}}

pos2 = Position[struct, 1/2]

{{1, 4, 7}, {1, 6, 5}, {2, 4, 6}, {2, 5, 7}, {3, 4, 5}, {3, 7, 6}, {4, 5, 3}, {4, 5, 8, 1}, {4, 5, 8, 2, 2}, {4, 6, 2}, {4, 7, 1}, {4, 8, 5, 2, 2}, {5, 1, 6}, {5, 3, 4}, {5, 4, 8, 2, 2}, {5, 7, 2}, {5, 8, 4, 1}, {5, 8, 4, 2, 2}, {6, 2, 4}, {6, 3, 7}, {6, 5, 1}, {6, 7, 8, 1}, {6, 7, 8, 2, 2}, {6, 8, 7, 2, 2}, {7, 1, 4}, {7, 2, 5}, {7, 6, 3}, {7, 6, 8, 2, 2}, {7, 8, 6, 1}, {7, 8, 6, 2, 2}, {8, 4, 5, 1}, {8, 4, 5, 2, 2}, {8, 5, 4, 2, 2}, {8, 6, 7, 1}, {8, 6, 7, 2, 2}, {8, 7, 6, 2, 2}}

Dimensions[struct]

{8, 8, 8}

As you can see, some of the outputs of pos2 have 5 indices, but I constructed struct to be an 8x8x8 table, so it should only have 3 indices. For example, one output is $\{4,8,5,2,2\}$. In the above code, Extract[{4,8,5,2,2}] is 1/2, but Extract[{4,8,5}] is -Sqrt[3]/2.

Can someone explain why this is happening or what this means? I would like to exclude these results which have outputs of a weird shape.

$\endgroup$

1 Answer 1

2
$\begingroup$

You have Sqrt[3]/2 entries in struct. The FullForm shows that it has two Rational entries that match.

FullForm[Sqrt[3]/2]

Times[Rational[1,2],Power[3,Rational[1,2]]]

To avoid it, use the levelspec argument and restrict Position to the third level:

pos2 = Position[struct, 1/2, 3]

{{1, 4, 7}, {1, 6, 5}, {2, 4, 6}, {2, 5, 7}, {3, 4, 5}, {3, 7, 6}, {4, 5, 3}, {4, 6, 2}, {4, 7, 1}, {5, 1, 6}, {5, 3, 4}, {5, 7, 2}, {6,
2, 4}, {6, 3, 7}, {6, 5, 1}, {7, 1, 4}, {7, 2, 5}, {7, 6, 3}}

$\endgroup$
1
  • $\begingroup$ Thanks for the accept. @tadpolio $\endgroup$
    – Syed
    Apr 23 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.