ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 20 Nov 2019 10:19:52 -0600Is there a command in SAGE which is equivalent to GAP's "ShallowCopy" ?https://ask.sagemath.org/question/48819/is-there-a-command-in-sage-which-is-equivalent-to-gaps-shallowcopy/Dear SAGE forum,
I'd like to ask the following question:
>> Is there an equivalent in SAGE of GAP's "shallowcopy" ?
I'd like to associate to two times the same group two different character tables.
In GAP it is possible to do it as follows:
G:=AlternatingGroup(5);
H:=ShallowCopy(G);
ct_G:=CharacterTable(G);
and to then construct a different character table for H.
When I try to do this in SAGE, I always get the error message that G (!) already has a character table, although I wanted to assign a different (as far as the ordering of the rows and columns are concerned) character table to H (!)
EDIT (20.11.2019):
Here is part of my sage code:
HHHH=gap.Image(iso)
GGGG=gap.ShallowCopy(gap.Image(iso))
# Hier Einschub: CTBL wie in CTBLLib (falls vorhanden) wird nun gemacht:
gap.LoadPackage('"ctbllib"')
def CTBL_Breuer_fert(X):
StrDescr = gap.StructureDescription(X)
if gap.IsString(gap.StructureDescription(X)):
StrDescr = gap.StructureDescription(X)
CTBL_Breuer = gap.CharacterTable(StrDescr)
CTBL_Breuer_fertig = gap.CharacterTableWithStoredGroup(X,CTBL_Breuer)
else:
CTBL_Breuer_fertig = gap.CharacterTable(X)
return(CTBL_Breuer_fertig)
CTBL_Breuer_fertig = CTBL_Breuer_fert(HHHH)
# Hier Ende des Einschubs
ccl = [gap.ConjugacyClass(GGGG,x) for x in MAGMA_ccls_GG_for_GAP]
gap.SetConjugacyClasses(GGGG,ccl)
gap.SetUnderlyingGroup(tbl,GGGG)
gap.SetConjugacyClasses(tbl,ccl)
bij=[1..len(ccl)]
MyRecordFile = open("GAP_Record.txt",'w')
print >> MyRecordFile, "bij:=",
print >> MyRecordFile, bij,
print >> MyRecordFile, ";"
print >> MyRecordFile, "myrecfunct:=function()"
print >> MyRecordFile, "local RECOR;"
print >> MyRecordFile, "RECOR:=rec(bijection:=bij);"
print >> MyRecordFile, "return RECOR;"
print >> MyRecordFile, "end;"
MyRecordFile.close()
gap.Read('"GAP_Record.txt"')
recor=gap.myrecfunct()
gap.CompatibleConjugacyClasses(GGGG,ccl,tbl,recor)
CTBL=gap.CharacterTableWithStoredGroup(GGGG,tbl,recor)
After this last line (with CTBL=...) the error occurs. When I delete the lines between "# Hier Einschub..." and "# Hier Ende des Einschubs ", then the code works.
I would be grateful for any help.
Thanks in advance.BernWed, 20 Nov 2019 10:19:52 -0600https://ask.sagemath.org/question/48819/How to create a subgroup with MAGMA inside SAGE of a group created with MAGMA inside SAGE?https://ask.sagemath.org/question/48678/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)]>')
/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:
>> _sage_[3]:=sub<GGG|[(1,2)]>;
^
User error: Identifier 'GGG' has not been declared or assigned
BernFri, 08 Nov 2019 12:14:46 -0600https://ask.sagemath.org/question/48678/Determining if two subgroups of a symmetric group are conjugatehttps://ask.sagemath.org/question/44357/determining-if-two-subgroups-of-a-symmetric-group-are-conjugate/If I have two particular subgroups of a symmetric group, is there any built-in way in Sage to determine if the groups are conjugate to one another? I tried creating a `ConjugacyClass` for each and then comparing them, but this gives an error:
S = SymmetricGroup(3)
gen1 = Permutation('(1,2,3)')
gen2 = Permutation('(1,3,2)')
gen3 = Permutation('(1,2)')
gen4 = Permutation('(1,3)')
G1 = PermutationGroup([gen1, gen3])
G2 = PermutationGroup([gen2, gen4])
ConjugacyClass(S, G1) == ConjugacyClass(S, G2)
When executing the very last line I get the error
TypeError: For implementing multiplication, provide the method '_mul_' for (1,2) resp. Permutation Group with generators [(1,2), (1,2,3)]
cjohnsonTue, 20 Nov 2018 13:06:56 -0600https://ask.sagemath.org/question/44357/Extension field adjoining two rootshttps://ask.sagemath.org/question/40389/extension-field-adjoining-two-roots/I'm trying to construct given an irreducible polynomial $f \in \mathbb{Q}[X]$ an extension field that adjoins two of its roots $\alpha_1,\alpha_2$. I'm trying to follow the approach suggested in [this question](https://ask.sagemath.org/question/40374/factorization-of-f-in-mathbbqx-in-field-extension-mathbbqalpha/)
. However, with the following code:
P.<x> = QQ[]
f = x^3+2*x+5 # f = P([5,2,0,0,1]) if you want
f_roots = f.roots(QQbar, multiplicities=False)
print f_roots
alpha = f_roots[0]
beta = f_roots[1]
K = QQ[alpha,beta]
K['x'](f).is_irreducible()
But this gives the error:
ValueError: defining polynomial (x^3 + 2*x + 5) must be irreducible
Although, the polynomial is clearly irreducible over $\mathbb{Q}$. Doing it as:
P.<x> = QQ[]
f = x^3+2*x+5
f_roots = f.roots(QQbar, multiplicities=False)
alpha = f_roots[0]
K.<a> = QQ[alpha]
beta = f_roots[1]
K1.<b> = K[beta]
Gives error:
ValueError: base field and extension cannot have the same name 'a'
What is going wrong? Is this the right way to construct the extension field with two roots?
**Edit**
Let me emphasize that I'm looking for a method that works for an arbitrary degree not just for degree 3. My actual problem goes on a degree four polynomial. So take as an example:
f = x^4+2*x+5
instead of the previous one.Rodrigo RayaSat, 30 Dec 2017 19:49:21 -0600https://ask.sagemath.org/question/40389/Factorization of $f \in \mathbb{Q}[X]$ in field extension $\mathbb{Q}(\alpha)$.https://ask.sagemath.org/question/40374/factorization-of-f-in-mathbbqx-in-field-extension-mathbbqalpha/I'm given an irreducible polynomial $f \in \mathbb{Q}[X]$ of degree 5 and I want to determine its Galois group without using the predefined functions of sage. The method I want to follow takes a root $\alpha_1$ of $f$ and studies the factorization of $f$ in the field extension $\mathbb{Q}(\alpha_1)$.
I believe this is possible with other software. How can I do it with sage?
**Edit**
Apparently, Abstract Algebra: An Interactive Approach, Second Edition but they use InitDomain function which is not recognized by my notebook.
Apparently the book gives a CD where an interface between sage and gap is done. So probably the solution requires using gap commands.Rodrigo RayaSat, 30 Dec 2017 12:14:54 -0600https://ask.sagemath.org/question/40374/What is a PARI group?https://ask.sagemath.org/question/40369/what-is-a-pari-group/Take for instance the example:
G = NumberField(x^5 + 15*x + 12, 't').galois_group(type="pari"); G
This gives an output:
Galois group PARI group [20, -1, 3, "F(5) = 5:4"] of degree 5 of the Number Field in t with defining polynomial x^5 + 15*x + 12
So I wonder what is the meaning of [20, -1, 3, "F(5) = 5:4"]. Is it some kind of permutation?
The relevant page of the [documentation](http://doc.sagemath.org/html/en/reference/groups/sage/groups/pari_group.html?highlight=pari%20group#module-sage.groups.pari_group) doesn't clarify it.Rodrigo RayaSat, 30 Dec 2017 06:30:00 -0600https://ask.sagemath.org/question/40369/Group action in sagehttps://ask.sagemath.org/question/38363/group-action-in-sage/I want to define a group action in sage. The group is a direct product of two general linear groups. The set under action is of matrices and the action is $(A,B) (M)=A^{-1}MB$. Assume all matrices have compatible sizes in order for multiplication.
I might need a stabelizer later so I was thinking doing it in GAP but could not figure out how. Any suggestions?upendra.kapshikarSat, 22 Jul 2017 13:33:12 -0500https://ask.sagemath.org/question/38363/How to compute a cyclic subgroup of a class group?https://ask.sagemath.org/question/38198/how-to-compute-a-cyclic-subgroup-of-a-class-group/ Hello, I am quite new to computing in Sage and I am stuck at this point. Please help me out. I am going to use algebraic number theory notation without explaining them in detail. All computations are in quadratic fields.
What I have :
- $\Delta_p=p^2\Delta_K$ where $p$ is a prime, $\Delta_K=-pq$ and $\Delta_K\equiv 1$ mod $4$
- I computed the class group, $C(\Delta_p)$ in Sage
What I want :
- Set $f=[(p^2,p)]$ in $C(\Delta_p)$ where $(p^2,p)$ is the standard representation of an ideal of norm $p^2$
- Set $F=\langle f \rangle$
My question is :
- How to get that cyclic subgroup $F$?
I have been looking at AbelianGroup and ClassGroup in Sage but I am not quite understanding how to use these to actually get what I want.
Any help in this matter would be greatly appreciated.jakkeonSat, 08 Jul 2017 12:52:42 -0500https://ask.sagemath.org/question/38198/Symmetry-findinghttps://ask.sagemath.org/question/36844/symmetry-finding/On pp. 152-3 of Hydon's [*Symmetry Methods for Differential Equations*](https://www.kent.ac.uk/smsas/personal/ph282/sym.htm) (2000 ed.), he lists some computer packages for symmetry-finding. [This related Mathematica StackExchange question](https://mathematica.stackexchange.com/q/20438/47125) mentions the [SYM](https://www.math.upatras.gr/~spawn/SYM_html/guide/SYMOverview.html) Mathematica package and Maple's [DEtools/symgen](https://www.maplesoft.com/support/help/Maple/view.aspx?path=DEtools/symgen). Does SAGE have anything similar for doing symmetry-finding?GeremiaMon, 06 Mar 2017 12:27:37 -0600https://ask.sagemath.org/question/36844/How to iterate through finite groupshttps://ask.sagemath.org/question/36326/how-to-iterate-through-finite-groups/ How can I have a collection of all finite groups with order less than a given number?
I have tried
G = gap.AllSmallGroups(64)
However it does not work for other arguments. It instead spits out this [1] error for example for 63 rather than 64.
I can tell that this may be a problem with the gap library in sage so I am wondering if there is any other way to do this in sage? I just want to be able to iterate through finite groups less than a given order.
[1]
Error in lines 3-4
Traceback (most recent call last):
File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 976, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 2, in <module>
File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 608, in __call__
return self._parent.function_call(self._name, list(args), kwds)
File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 921, in function_call
res = self.eval(marker+cmd)
File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 575, in eval
result = Expect.eval(self, input_line, **kwds)
File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/interfaces/expect.py", line 1294, in eval
for L in code.split('\n') if L != ''])
File "/projects/sage/sage-7.3/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 771, in _eval_line
raise RuntimeError(message)
RuntimeError: Gap produced error output
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 2nd choice method found for `RankPGroup' on 1 arguments
executing __SAGE_LAST__:="__SAGE_LAST__";;Rank(\$sage1);;alizterTue, 17 Jan 2017 07:04:35 -0600https://ask.sagemath.org/question/36326/using GAP: Group Theoryhttps://ask.sagemath.org/question/35735/using-gap-group-theory/I'm trying this code base on the book "Adventures in Group Theory" from D.Joyner
MS=MatrixSpace(GF(2),3,3)
A=MS([0,1,0,1,0,0,0,0,1])
B=MS([1,0,0,0,0,1,0,1,0])
G=MatrixGroup([A,B]) G1=SymmetricGroup(3)
imG=G._gap_().IsomorphismPermGroup().Image(G._gap_())
imG
> `Sym( [ 2 .. 4 ] )`
gens=imG.GeneratorsOfGroup()
gens
> `[ (3,4), (2,3) ]`
G2=PermutationGroup([(3,4),(2,3)])
G2.is_isomorphic(G1)
> `True`
However, there seems to be a signature problem the following commands don't work:
(the first one was from the book, I tried myself the second one)
G2=PermutationGroup(gens)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_92.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("RzI9UGVybXV0YXRpb25Hcm91cChnZW5zKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/private/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/tmpHRYMWK/___code___.py", line 2, in <module>
exec compile(u'G2=PermutationGroup(gens)
File "", line 1, in <module>
File "/Applications/SageMath/local/lib/python2.7/site-packages/sage/groups/perm_gps/permgroup.py", line 343, in PermutationGroup
raise TypeError("gens must be a tuple, list, or GapElement")
TypeError: gens must be a tuple, list, or GapElement
G2=PermutationGroup(list(gens))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_79.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("RzI9UGVybXV0YXRpb25Hcm91cChsaXN0KGdlbnMpKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/private/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/tmpOxJAnr/___code___.py", line 2, in <module>
exec compile(u'G2=PermutationGroup(list(gens))
File "", line 1, in <module>
File "/Applications/SageMath/local/lib/python2.7/site-packages/sage/groups/perm_gps/permgroup.py", line 345, in PermutationGroup
canonicalize=canonicalize, category=category)
File "/Applications/SageMath/local/lib/python2.7/site-packages/sage/groups/perm_gps/permgroup.py", line 419, in __init__
for cycle in x:
TypeError: 'sage.libs.gap.element.GapElement_Permutation' object is not iterable
I cannot make much of the documentation. Thanks.faguiFri, 25 Nov 2016 01:50:39 -0600https://ask.sagemath.org/question/35735/Semimonomial transformation grouphttps://ask.sagemath.org/question/34134/semimonomial-transformation-group/I have a subgroup of the semimonomial transformation group which is implemented in Sage and would like to be able to use for example the Orbit-functions in GAP, any ideas of how to do this?
Below I compute the full automorphism group of a linear [8,5] code over GF(4), with its generators stored in the variable "Gautgens".
f.<w>=GF(4,'x')
G=matrix(f,[[1,0],[w,1]])
Gt=reduce(lambda x,y:x.tensor_product(y,subdivide=False),[G]*3)
C=LinearCode(Gt[range(3,8)])
Gautgens=C.automorphism_group_gens()[0]
What I would like to do is to use the Orbits-function in GAP to find the orbits of some vectors in GF(4)^8 (v1,v2,v3,...) under the action of the automorphism group above. That is, something like:
gap.Orbits(gap.Group(Gautgens),[v1,v2,v3,..],"On....")
But I don't know how to make the automorphism group a group in GAP.
An alternative solution for me would be to map the automorphism group to an isomorphic permutation group acting on points. That is I would number all the vectors in GF(4)^8 and the automorphism group would then act as a permutation group on this indexing.AxelDTue, 19 Jul 2016 10:57:35 -0500https://ask.sagemath.org/question/34134/Group Acting on a Sethttps://ask.sagemath.org/question/33634/group-acting-on-a-set/ Say I have a list $V$ (or a set $V$; either would be fine) of 5-tuples; e.g.,
V = [(0,1,1,0,0), (1,0,0,1,1), (0,0,0,1,0)].
Is there a pre-defined function in Sage to create a list $W$ of all 5-tuples generated when the group $S_5$ of permutations of $\{1,2,3,4,5\}$ acts of $V$? If not, is there a relatively quick way that I could go about this?
JEAWed, 01 Jun 2016 15:42:34 -0500https://ask.sagemath.org/question/33634/p-part of a class grouphttps://ask.sagemath.org/question/9849/p-part-of-a-class-group/Hi
I am trying to compute the p-part of a class groups of some number fields. I was hoping to just call G.sylow_subgroup(p), but this function is not implemented for Abelian groups. In addition, invariants doesn't seem to work, for example, if G= C6, then G.invariants() returns [6], which doesn't seem correct.
I would appreciate any advice on how to do this. For example, can I coerce an Abelian Group to just be a finite group?
Note: I asked this on IRC without an answer. I hope it is not bad form to ask it here.
Partial Solution: Elementary divisors and some factorization code gives me what I want. However, it would be nice to be able to coerce an abelian group into a group.lalitkumarjMon, 25 Feb 2013 05:09:12 -0600https://ask.sagemath.org/question/9849/Special Linear Grouphttps://ask.sagemath.org/question/33501/special-linear-group/Hello! I am having some trouble getting the list of matrices of the group SL of order 2.
When I do these calculations:
G=SL(2,GF(3))
print(list(G))
I get the list of elements of the special linear group or order 2 over the finite field of size 3.
However, when I try
G=SL(2,GF(4))
print(list(G))
the matrices appear with "z2" in them. I have noticed that this happens when the size of the field is not prime, but I don't know how to get past it.
Thank you in advance.RicardoSat, 21 May 2016 17:44:14 -0500https://ask.sagemath.org/question/33501/Permutation set acting on another sethttps://ask.sagemath.org/question/33432/permutation-set-acting-on-another-set/ How do I make a set of permutation acting on another set?
A4 = AlternatingGroup(4)
r1 = A4("(1,2) (3,4)")
r2 = A4("(1,3) (2,4)")
r3 = A4("(1,4) (2,3)")
N = A4.subgroup([r1, r2, r3]) # generate normal subgroup
LC = A4.cosets(N, side="left")
print LC
print LC[0]*LC[1]
Here I want coset `LC[0]` act on `LC[1]`. How do I make it?huhahuTue, 17 May 2016 15:38:47 -0500https://ask.sagemath.org/question/33432/How to iterate over groups in increasing sizehttps://ask.sagemath.org/question/33358/how-to-iterate-over-groups-in-increasing-size/I would like some way to iterate over all finite groups in increasing size till I manually stop the program (preferably as permutation groups). Is there an easy command to do this? AsvinTue, 10 May 2016 15:14:01 -0500https://ask.sagemath.org/question/33358/How to find a particular coset?https://ask.sagemath.org/question/33317/how-to-find-a-particular-coset/I am in the situation where I have groups $A,G$ with $G$ normal in $A$ such that $A/G$ is cyclic. I would like to find the coset of $G$ corresponding to a generator of $A/G$. AsvinWed, 04 May 2016 11:17:55 -0500https://ask.sagemath.org/question/33317/Reference request for group theory commandshttps://ask.sagemath.org/question/33285/reference-request-for-group-theory-commands/ I feel fairly stupid for asking this but where is the list of commands for group theory in sage? For instance, I would like to know how to find the number of fixed points of a given permutation.
I tried to google it but all I come across are various introductory tutorials and none of them seem to be complete documentations. I am sure I am missing something simple...AsvinMon, 02 May 2016 01:57:10 -0500https://ask.sagemath.org/question/33285/How to efficiently test whether a matrix can be written as a certain type of wordhttps://ask.sagemath.org/question/32935/how-to-efficiently-test-whether-a-matrix-can-be-written-as-a-certain-type-of-word/ I am pretty new to Sage. I plan on learning/practicing more but for now I need a quick way of getting some data, so I'm hoping hoping to get some tips.
Suppose I have a discrete subgroup H of SL(2,C), and I have a subgroup G of H. Both of these groups are finitely generated, and I have a list of generators for each group. Given some element h of H, I want an efficient way of telling whether or not there exists an element g of G such that h=gg* where g* is the conjugate transpose of g. Note that the membership problem is decidable for SL(2,C), but this problem is much easier than finding an algorithm for that general case.
What I did so far is I computed each generator of G in terms of the generators of H by writing a script that went through by word length. I also computed a list of matrices of the form gg* up to words in G up to length 3, but the order in which these show up is not convenient.
So, let h be some element of H, given as a matrix. My plan is to write h in terms of the generators of H, so that I can more easily recognize whether it's of the form I want, by comparing it to the words for the generators of G. But my method of doing this is veeeerry slow, too slow to suit my purposes. An important factor is that there are a *lot* of elements in H that I need to check this on, so I need to be able to run this quickly. Preferably I would define lists of matrices to check, then have a program that just runs through the lists and tells me which ones meet my condition.
I feel like I may be reinventing the wheel in some parts of this, since it seems a fairly common problem to be studying words in matrices. Perhaps there is a pre-built module that has tools I could use but so far I have not found anything.
Thanks in advance.
*My original post had a typo, and said SL(2,Z) rather than SL(2,C). The answer below from @vdelecroix pertains to the original post.*j0equ1nnFri, 01 Apr 2016 02:39:33 -0500https://ask.sagemath.org/question/32935/what is the equivalent command of gap in sagehttps://ask.sagemath.org/question/32348/what-is-the-equivalent-command-of-gap-in-sage/ gap command,
g1:=Group((2, 3)(4, 5));
g2:=Group((1, 5)(3, 4));
cg:=AllHomomorphisms(g1,g2);
i see that sage seems need to define GF or other things, what is the sage command of above gap command
i am finding an input for this function
K.<x> = FunctionField(cg[3]);grammar001Thu, 28 Jan 2016 05:29:05 -0600https://ask.sagemath.org/question/32348/Compute all Elements of a subgroup GL_3(R)https://ask.sagemath.org/question/30739/compute-all-elements-of-a-subgroup-gl_3r/ Hi there, i have two matrices A and B, they both out Gl_3(R). I have find all Elements in the Subgroup created by these two. is there a way to do it in sage?
M3 = MatrixSpace(QQ, 3) # Rational numbers
print("Identity matrix:")
show(M3.identity_matrix())
A = M3.matrix([[1, 0, 0], [0, -1, 0], [0, 0, -1]])
B = M3.matrix([[0, 1, 0], [0, 0, 1], [1, 0, 0]])
There should be 36 Elements in this group B is cyclic B^3=I
and A creates 2 possible Element by negating elements. so the Left inverses create 6 Elements and the Right creates also 6, total is 36. thethaSun, 15 Nov 2015 07:24:19 -0600https://ask.sagemath.org/question/30739/How do I create the character table of the group of units mod n ?https://ask.sagemath.org/question/30501/how-do-i-create-the-character-table-of-the-group-of-units-mod-n/I expected a character table from
g=Zmod(5).unit_group()
g.character_table()
instead I got an error message ending with
AttributeError: 'AbelianGroupWithValues_class_with_category' object has no attribute 'character_table'
How do I create the character table of the group of units mod n ?nilo de roockFri, 06 Nov 2015 03:18:17 -0600https://ask.sagemath.org/question/30501/Error when computing Automorphism Grouphttps://ask.sagemath.org/question/29658/error-when-computing-automorphism-group/ I am new to Sage. Recently, I tried to compute the Automorphism Group of $\mathbb{Z}_4\times\mathbb{Z}_2$ in the following way:
G = CyclicPermutationGroup(4)
H = CyclicPermutationGroup(2)
D=G.direct_product(H)
D.automorphism_group()
However, there was an error message:
Error in lines 4-4
Traceback (most recent call last):
File "/projects/0aeca2d0-1a41-47c7-b462-f4a4432bfbf3/.sagemathcloud/sage_server.py", line 881, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
AttributeError: 'tuple' object has no attribute 'automorphism_group'
May I know where does the error in the code lie? Thanks!mathtuition88Thu, 01 Oct 2015 10:00:48 -0500https://ask.sagemath.org/question/29658/Easiest way to work in the multiplicative group of Zmod(n)https://ask.sagemath.org/question/29639/easiest-way-to-work-in-the-multiplicative-group-of-zmodn/Given an integer $n$, one can define in SageMath the additive group $\mathbb Z/n\mathbb Z$ by
sage: Zn = Zmod(n) # or Integers(n)
Now, I would like to work in the multiplicative group $(\mathbb Z/n\mathbb Z)^*$. Of course, I can write
sage: G = [a for a in Zn if gcd(a,n) == 1]
sage: Zn(4).multiplicative_order()
6
What I would like is an easier way of writing such a thing, such as:
sage: G = Zn.multiplicative_group() # does not exist!
sage: G(4).order()
6
Does there exist something in SageMath to perform such kind of computations?B r u n oMon, 28 Sep 2015 11:24:45 -0500https://ask.sagemath.org/question/29639/subgroup of number field unit grouphttps://ask.sagemath.org/question/27274/subgroup-of-number-field-unit-group/I would like to be able to create subgroups of a unit group generated by given elements. I haven't, thus far, been able to find a way to make this work. The following doesn't work:
N.<a> = NumberField(x^3+2)
G = N.unit_group()
g = G.random_element()
G.subgroup([g])
Can anyone help me find a workaround?
(Note: it appears to be a bug, see [trac.sagemath.org/ticket/18863](http://trac.sagemath.org/ticket/18863), but I'm just looking for a workaround for now.)Kate StangeTue, 07 Jul 2015 17:59:55 -0500https://ask.sagemath.org/question/27274/Finding representatives of group cohomology classeshttps://ask.sagemath.org/question/10990/finding-representatives-of-group-cohomology-classes/Could someone help me perform the GAP calculation described at the MathOverflow question [Explicit 3 cocycles for the symmetric group](http://mathoverflow.net/questions/92684/explicit-3-cocycles-for-the-symmetric-group-s-6) in Sage?Scott MorrisonTue, 18 Feb 2014 01:45:05 -0600https://ask.sagemath.org/question/10990/Subgroups of Linear Groupshttps://ask.sagemath.org/question/10916/subgroups-of-linear-groups/I want to find the subgroup which is generated by two elements.
>G = SL(2,GF(3))
>D = G.subgroup([G[1],G[2]])
Why do I have this error:
>Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_50.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + >_support_.preparse_worksheet_cell(base64.b64decode("RyA9IFNMKDIsR0YoMykpCkQgPSBH>LnN1Ymdyb3VwKFtCWzFdLEJbMl1dKQ=="),globals())+"\\n"); >execfile(os.path.abspath("___code___.py"))
> File "", line 1, in <module>
> File "/private/var/folders/rp/rpRaJRnOEQyzp4ftzijESU+++TI/-Tmp-/tmpGFGoqT/___code___.py", line 4, in <module>
> exec compile(u'D = G.subgroup([B[_sage_const_1 ],B[_sage_const_2 ]])
> File "", line 1, in <module>
> File "parent.pyx", line 620, in sage.structure.parent.Parent.__getattr__ >(sage/structure/parent.c:5943)
> File "misc.pyx", line 200, in sage.structure.misc.getattr_from_other_class >(sage/structure/misc.c:1427)
>AttributeError: 'SpecialLinearGroup_finite_field_with_category' object has no >attribute 'subgroup'
BabgenWed, 15 Jan 2014 03:37:38 -0600https://ask.sagemath.org/question/10916/Testing if a group has a subgroup acting regularlyhttps://ask.sagemath.org/question/10879/testing-if-a-group-has-a-subgroup-acting-regularly/I am given a PermuationGroup $G$ and would like to find out if $G$ has a subgroup $H$ that acts regularly. The insane way to do it is of course to iterate over all subgroups of $G$ of size of the acting set and testing for regularity.
My question is - is there a more efficient way to do this?
Best,
JernejJernejFri, 03 Jan 2014 01:51:53 -0600https://ask.sagemath.org/question/10879/Error with Automorphism grouphttps://ask.sagemath.org/question/10871/error-with-automorphism-group/I use this for computing automorphism group:
G = SymmetricGroup(3)
H = libgap(G).AutomorphismGroup()
but when I want to compute order of automorphism group, I cant compute and I have this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_20.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("RyA9IFN5bW1ldHJpY0dyb3VwKDMpCkggPSBsaWJnYXAoRykuQXV0b21vcnBoaXNtR3JvdXAoKQpILm9yZGVyKCk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/tmp/tmpm9uLkv/___code___.py", line 5, in <module>
exec compile(u'H.order()
File "", line 1, in <module>
File "element.pyx", line 1867, in sage.structure.element.RingElement.order (sage/structure/element.c:15911)
File "element.pyx", line 1873, in sage.structure.element.RingElement.additive_order (sage/structure/element.c:15968)
NotImplementedError
BabgenWed, 01 Jan 2014 06:00:14 -0600https://ask.sagemath.org/question/10871/