Ask Your Question
1

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

asked 2019-11-08 19:14:46 +0100

Bern gravatar image

updated 2020-06-01 10:53:39 +0100

FrédéricC gravatar image

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)]&gt;')< 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)]&gt;; out:<="" p="">

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

edit retag flag offensive close merge delete

Comments

1

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.

rburing gravatar imagerburing ( 2019-11-09 09:21:35 +0100 )edit

Thank you very much for your comment! :-)

Bern gravatar imageBern ( 2019-11-09 21:34:12 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2019-11-09 20:25:57 +0100

nbruin gravatar image

updated 2019-11-09 21:29:46 +0100

As pointed out in a comment, there is a naming issue: you first create an object representing $S_4$ and bind it to the name GGG in sage. The object itself doesn't know about that binding or name, so when you translate it to Magma, that information is not present there. Objects created via sage's magma interface will be stored in the list _sage_, so your group can probably be referred to via something like _sage_[2] or so. Figuring out which place it's stored in is a rather fragile operation, though. It would be better to let the interface do that lookup for you.

The subgroup you want to make could be created via something like

GGG.sub(sigma)

where sigma is the cycle $(1,2)$ represented in magma. This is difficult to obtain, because magma's syntax for creating permutation group elements is finicky: you need a "group context" to create it, and I don't think the standard interface tools allow you to do this. Ideally something like magma(gensGG[2]) would do the trick, but it doesn't.

This works, though:

sigma = magma('Sym(4)!(1,2)')

I think going forward, your chances of success would be a little better by using sage's own wrappers of Gap's permutation groups:

sage: GG=SymmetricGroup(4)
sage: sigma=GG( (1,2))

although that object sigma still doesn't know how to be translated to magma. Implementing that would be fairly straightforward, though (and it would end up doing the analogue of what is done above).

edit flag offensive delete link more

Comments

Thank you very much for your answer! :-)

Bern gravatar imageBern ( 2019-11-09 21:33:58 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-11-08 19:14:46 +0100

Seen: 409 times

Last updated: Nov 11 '19