Repository: sympy/sympy

Issue:
is_isomorphic fails in detecting an isomorphism between two groups
If we launch this script:

```
a = Permutation(0, 1)(2, 4)(3,5)
b = Permutation(0, 2)(1, 3)(4,5)

H=PermutationGroup([a, b])
test_group = SymmetricGroup(3)

print(H.order())

print(is_isomorphic(test_group,H))

```
we get:

```
6
False

```
so is_isomorphic says that the groups aren't isomorphic, but they actually are: the order of H is 6 and H is not abelian (you can check that a*b and b*a are different), so H has to be isomorphic to S3 since S3 is the only non abelian group of order 6.
You can also check on gap, there the groups are isomorphic.

```
# 1. Define your generators (1-based)
g1 := (1,2)(3,5)(4,6);
g2 := (1,3)(2,4)(5,6);

# 2. Create the group Q
Q := Group(g1, g2);

# 3. Define S3
S3 := SymmetricGroup(3);

id_Q := IdGroup(Q);

# 4. Print the result and compare it with the ID of S3
Print("ID of group Q: ", id_Q, "\n");
Print("ID of group S3: ", IdGroup(S3) , "\n");

```
I run the code above in the sagemath cell for gap, and got the same identifier.

Discussion:

Fix (patch):
diff --git a/sympy/combinatorics/homomorphisms.py b/sympy/combinatorics/homomorphisms.py
index 256f56b3aa7c..7211654f7b95 100644
--- a/sympy/combinatorics/homomorphisms.py
+++ b/sympy/combinatorics/homomorphisms.py
@@ -510,7 +510,7 @@ def group_isomorphism(G, H, isomorphism=True):
 
     # Match the generators of `G` with subsets of `_H`
     gens = list(G.generators)
-    for subset in itertools.permutations(_H, len(gens)):
+    for subset in itertools.permutations(_H.generate(), len(gens)):
         images = list(subset)
         images.extend([_H.identity]*(len(G.generators)-len(images)))
         _images = dict(zip(gens,images))


Test changes:
diff --git a/sympy/combinatorics/tests/test_homomorphisms.py b/sympy/combinatorics/tests/test_homomorphisms.py
index 0936bbddf46a..fa7d7f78f739 100644
--- a/sympy/combinatorics/tests/test_homomorphisms.py
+++ b/sympy/combinatorics/tests/test_homomorphisms.py
@@ -3,7 +3,7 @@
 from sympy.combinatorics.homomorphisms import homomorphism, group_isomorphism, is_isomorphic
 from sympy.combinatorics.free_groups import free_group
 from sympy.combinatorics.fp_groups import FpGroup
-from sympy.combinatorics.named_groups import AlternatingGroup, DihedralGroup, CyclicGroup
+from sympy.combinatorics.named_groups import AlternatingGroup, DihedralGroup, CyclicGroup, SymmetricGroup
 from sympy.testing.pytest import raises
 
 def test_homomorphism():
@@ -106,6 +106,11 @@ def test_isomorphisms():
     assert G.order() == H.order()
     assert is_isomorphic(G, H)
 
+    a = Permutation(0, 1)(2, 4)(3,5)
+    b = Permutation(0, 2)(1, 3)(4,5)
+    H=PermutationGroup([a, b])
+    assert is_isomorphic(SymmetricGroup(3),H)==True
+
 
 def test_check_homomorphism():
     a = Permutation(1,2,3,4)