ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 23 Jul 2023 01:30:16 +0200How to check whether a given group contains a subgroup isomorphic to Quaternion grouphttps://ask.sagemath.org/question/70573/how-to-check-whether-a-given-group-contains-a-subgroup-isomorphic-to-quaternion-group/ I want to check whether a given group $G$ has a subgroup isomorphic to $Q_8$. What should be the SAGE command for this? I am aware of the command "H.is_subgroup(G)". Does it check whether $H$ is contained in $G$ or $H$ is isomorphic to a subgroup in $G$?Thu, 20 Jul 2023 18:24:16 +0200https://ask.sagemath.org/question/70573/how-to-check-whether-a-given-group-contains-a-subgroup-isomorphic-to-quaternion-group/Answer by dan_fulea for <p>I want to check whether a given group $G$ has a subgroup isomorphic to $Q_8$. What should be the SAGE command for this? I am aware of the command "H.is_subgroup(G)". Does it check whether $H$ is contained in $G$ or $H$ is isomorphic to a subgroup in $G$?</p>
https://ask.sagemath.org/question/70573/how-to-check-whether-a-given-group-contains-a-subgroup-isomorphic-to-quaternion-group/?answer=70708#post-id-70708Same as the answer of lisbeth, but we restrict to conjugacy classes of subgroups. And use the fact that they come in the order of their orders. So if we pass the order eight we have a verdict. Sample code checking if the group `G` below has a subgroup isomorphic to `Q8`:
Q8 = QuaternionGroup()
def hasQ8isomorphicSubgroup(G, verbose=False):
for H in G.conjugacy_classes_subgroups():
if H.order() < 8: continue
if H.order() > 8: break
if verbose:
print(f"Subgroup of order 8 with structure {H.structure_description()}")
if H.is_isomorphic(Q8):
return True # or we can return H
return False
Then we have for instance:
sage: G = PSL(2, 17)
....: hasQ8isomorphicSubgroup(G)
False
sage: G = PSL(2, 17)
....: hasQ8isomorphicSubgroup(G, verbose=True)
Subgroup of order 8 with structure C8
Subgroup of order 8 with structure D4
Subgroup of order 8 with structure D4
False
Some other example:
sage: G = PSL(3, 7)
sage: hasQ8isomorphicSubgroup(G, verbose=True)
Subgroup of order 8 with structure Q8
True
Sun, 23 Jul 2023 01:30:16 +0200https://ask.sagemath.org/question/70573/how-to-check-whether-a-given-group-contains-a-subgroup-isomorphic-to-quaternion-group/?answer=70708#post-id-70708Answer by lisbeth for <p>I want to check whether a given group $G$ has a subgroup isomorphic to $Q_8$. What should be the SAGE command for this? I am aware of the command "H.is_subgroup(G)". Does it check whether $H$ is contained in $G$ or $H$ is isomorphic to a subgroup in $G$?</p>
https://ask.sagemath.org/question/70573/how-to-check-whether-a-given-group-contains-a-subgroup-isomorphic-to-quaternion-group/?answer=70600#post-id-70600You 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!')Fri, 21 Jul 2023 10:21:50 +0200https://ask.sagemath.org/question/70573/how-to-check-whether-a-given-group-contains-a-subgroup-isomorphic-to-quaternion-group/?answer=70600#post-id-70600