I defined the dihedral group with $n=6$ in SageMath as follows:
D6 = DihedralGroup(6)
I'm trying to list the elements by the convention of my algebra text books where $r$ is $60 ^{\circ}$ clockwise rotation and $s$ is reflection along the $y$-axis.
I'm trying to determine which symmetry is which.
D6.cayley_table(names = ["1","r4","r2","r5","r3","r","sr","sr5", "sr3","s","sr4","sr2"])
But the Cayley table this outputs isn't correct. What's the proper order of listing.
One way to do this is to generate the list of names that you want, then get the corresponding cayley table.
I will first describe a general answer that works for any dihedral group $D_n$, where we take $r$ to be the rotation counterclockwise by $\frac{2\pi}{n}$ radians, and $s$ to be reflection in the $x$-axis.
The reason we take this choice is that sage represents $D_n$ internally as the permutations of the vertices of the regular $n$-gon whose vertices are given by the $n$-th roots of unity. So, you will always have a reflection in the $x$-axis, but not necessarily in the $y$-axis (unless $n$ is even).
So, lets start by defining the dihedral group of size $n$. I will use $n = 6$ as an example.
Now, we grab the elements corresponding to $r$ and $s$ out of this group.
And similarly for $s$:
Now, we use this to make a list of names and a corresponding list of elements as follows:
The resulting lists are as follows:
and the corresponding list of elements:
We now make the Cayley table using these names and elements:
Giving as output the cayley table
Now, you mentioned wanting to have $s$ be the reflection in the $y$-axis instead. The exact same code above will work, we just have to change $s$ to
however as you will note if you try this, the Cayley table doesn't change. The reason for this is that no matter what reflection $t = sr^i$ you pick, you have $t^2 = 1$ and $(tr)^2 = (sr^{i + 1})^2 = 1$, so any choice will give the same (isomorphic/equivalent) presentation of $D_6$ hence the same Cayley table (and more generally for any $D_n$).