# How to create a subgroup with MAGMA inside SAGE of a group created with MAGMA inside SAGE?

Dear SAGE team,

I would like to let MAGMA inside SAGE create a subgroup of a group (which was also created with MAGMA inside SAGE), but an error message was returned.

Unfortunately, I don't know ho to resolve this.

I would be thankful for any help.

Here's the code (only an example):

sage: GG=gap.SymmetricGroup(4)

sage: gensGG = gap.GeneratorsOfGroup(GG)

sage: m=gap.LargestMovedPoint(gensGG)

sage: GGG=magma.Sym(m)

sage: GG_MAGMA=magma.new('sub< GGG | [(1,2)] > ')

The error message is as follows:

TypeError Traceback (most recent call last) <ipython-input-13-da9ee2cf66f9> in <module>() ----> 1 GG_MAGMA=magma.new('sub<ggg|[(1,2)]>')< p="">

/var/autofs/nfs/scratch/hannes/sage-8.8/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in new(self, code) 351 352 def new(self, code): --> 353 return self(code) 354 355 ###################################################################

/var/autofs/nfs/scratch/hannes/sage-8.8/local/lib/python2.7/site-packages/sage/interfaces/magma.pyc in __call__(self, x, gens) 792 pass 793 --> 794 A = Expect.__call__(self, x) 795 if has_cache: 796 x._magma_cache[self] = A

/var/autofs/nfs/scratch/hannes/sage-8.8/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in __call__(self, x, name) 286 287 if isinstance(x, string_types): --> 288 return cls(self, x, name=name) 289 try: 290 return self._coerce_from_special_method(x)

/var/autofs/nfs/scratch/hannes/sage-8.8/local/lib/python2.7/site-packages/sage/interfaces/expect.pyc in __init__(self, parent, value, is_name, name) 1441 except (RuntimeError, ValueError) as x: 1442 self._session_number = -1 -> 1443 raise_(TypeError, TypeError(*x.args), sys.exc_info()[2]) 1444 except BaseException: 1445 self._session_number = -1

/var/autofs/nfs/scratch/hannes/sage-8.8/local/lib/python2.7/site-packages/sage/interfaces/expect.pyc in __init__(self, parent, value, is_name, name) 1436 else: 1437 try: -> 1438 self._name = parent._create(value, name=name) 1439 # Convert ValueError and RuntimeError to TypeError for 1440 # coercion to work properly.

/var/autofs/nfs/scratch/hannes/sage-8.8/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in _create(self, value, name) 482 def _create(self, value, name=None): 483 name = self._next_var_name() if name is None else name --> 484 self.set(name, value) 485 return name 486

/var/autofs/nfs/scratch/hannes/sage-8.8/local/lib/python2.7/site-packages/sage/interfaces/magma.pyc in set(self, var, value) 627 13/5 628 """ --> 629 out = self.eval("%s:=%s" % (var, value)) 630 if out.lower().find("error") != -1: 631 raise TypeError("Error executing Magma code:\n%s" % out)

/var/autofs/nfs/scratch/hannes/sage-8.8/local/lib/python2.7/site-packages/sage/interfaces/magma.pyc in eval(self, x, strip, **kwds)
561 ans = Expect.eval(self, x, **kwds).replace('\\n', '')
562 if 'Runtime error' in ans or 'User error' in ans:
--> 563 raise RuntimeError("Error evaluating Magma code.\nIN:%s\nOUT:%s" % (x, ans))
564 return ans
565

TypeError: Error evaluating Magma code. IN:_sage_[3]:=sub<ggg|[(1,2)]>; out:<="" p="">

_sage_[3]:=sub<ggg|[(1,2)]>; ^="" user="" error:="" identifier="" 'ggg'="" has="" not="" been="" declared="" or="" assigned<="" p="">

Assuming that the rest of the code is correct, the issue is that you use the text

`"GGG"`

to refer to the variable`GGG`

. Instead you should use something like`GGG.name()`

. I don't have Magma so I am not sure of the exact syntax; try`dir(GGG)`

to find the right method name.Thank you very much for your comment! :-)