1 | initial version |
You first define the quaternion group Q using the QuaternionGroup
constructor. You then define the group G that you want to check for a subgroup isomorphic to Q, which in this case is the dihedral group of order 12, for example.
You then use the subgroups method to get a list of all subgroups of G. For each subgroup H in the list, you check if H is isomorphic to Q using the is_isomorphic
method. If you find a subgroup that is isomorphic to Q, you can print the subgroup and a message indicating that you found a subgroup isomorphic to the quaternion group.
Please see the following code:
Q = QuaternionGroup()
G = DihedralGroup(12)
subgroups = G.subgroups()
for H in subgroups:
if H.is_isomorphic(Q):
print(f'Found a subgroup {H} isomorphic to the quaternion group!')