ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 04 Aug 2019 07:52:38 -0500Determining if two subgroups of a symmetric group are conjugatehttp://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 -0600http://ask.sagemath.org/question/44357/Code to find separating set in SageMath of a given Graphhttp://ask.sagemath.org/question/47381/code-to-find-separating-set-in-sagemath-of-a-given-graph/ Given a Graph $G$ how can I find the separating set of the Graph?
Suppose I am given this graph G=Graph({1:[2,3,4,5],2:[1,3,4,5],3:[1,2,4,5],4:[1,2,3],5:[1,2,3]})
I want to find the set of vertices whose removal disconnects the graph.
I found that the vertex connectivity of $G$ is 2.
Also on seeing the graph I find that the set of vertices whose removal disconnects the graph will be $(1,2,3)$
But how to find it using a code in SageMath?CaptchaSun, 04 Aug 2019 07:52:38 -0500http://ask.sagemath.org/question/47381/Is there any code to calculate the subgroup generated by the permutationshttp://ask.sagemath.org/question/47371/is-there-any-code-to-calculate-the-subgroup-generated-by-the-permutations/ Consider the Symmetric Group $S_4$
I have three permutations namely $(3,4), (1,2), (1,3)(2,4)$.
How to find the subgroup generated by these permutations ?
Is there any code to calculate in Sagemath the subgroup generated by the permutations given above?
As an example the code should work like this :
If I input $(12)$ the code should give $\{(12),e\}$
Can someone help please?CaptchaSun, 04 Aug 2019 01:16:11 -0500http://ask.sagemath.org/question/47371/Constructing graphs using permutation or symmetric groupshttp://ask.sagemath.org/question/46450/constructing-graphs-using-permutation-or-symmetric-groups/ I'm trying to construct a graph whose vertices are the elements of a permutation group or a symmetric group. Whenever I do this, it ignores the identity element (). For instance, when I use the Symmetric Group S3, it prints a graph with 5 vertices and the missing vertex is the identity.
Any ideas on why this happening and how I can fix it? homiermorphismSat, 04 May 2019 15:47:42 -0500http://ask.sagemath.org/question/46450/Obtaining integers from a linear extension of a poset.http://ask.sagemath.org/question/45668/obtaining-integers-from-a-linear-extension-of-a-poset/I'm quite new to Sage so this might be a very easy question.
Suppose that I have defined a linear extension of a poset in Sage like this:
P = Poset(([1,2,3,4], [[1,3],[1,4],[2,3]]), linear_extension=True, facade=False)
p = P.linear_extension([1,4,2,3])
Is there a way for me to make this linear extension into a permutation? That is, I would like to obtain the permutation [1,4,2,3] from p.joakim_uhlinTue, 05 Mar 2019 09:21:13 -0600http://ask.sagemath.org/question/45668/does as_permutation_group() respect generators?http://ask.sagemath.org/question/40927/does-as_permutation_group-respect-generators/From sage documentation I can construct a group as follows:
sage: m1 = matrix(GF(11), [[1,2],[3,4]])
sage: m2 = matrix(GF(11), [[1,3],[10,0]])
sage: G = MatrixGroup(m1, m2); G
Matrix group over Finite Field of size 11 with 2 generators (
[1 2] [ 1 3]
[3 4], [10 0]
)
Now I use the following code:
sage: G_p=G.as_permutation_group(); G_p
Permutation Group with generators [(1,2,3,4,5,6,7,8,9,10,11)(12,13,15,14,16)(17,18), (1,3,5,7,9,11,2,4,6,8,10)(12,14,13,16,15)(17,18)]
In this case it is true that the generators of G are in correspondence with the generators of G_p. Is this always the case? I mean, if I compute a very complicated group G with lots of generators and its corresponding permutation group G_p, then is it true that G.gens()[i] corresponds to G_p.gens[i]?amontero90Thu, 01 Feb 2018 13:20:47 -0600http://ask.sagemath.org/question/40927/Matrix Permutationshttp://ask.sagemath.org/question/40180/matrix-permutations/ Hello,
how do I get all permutations of a Matrix?
For the following exercise I would like to get all permutations of a Matrix with integer values in the range $0$ to $9$. There should be $10^4$ permutations. And then generate the permutations of tuples with three matrices. $10^{12}$ permutations and then I would filter the list somehow for the invertible matrices.
Is there a better way?
Exercise:
Let $S, T, U \in \mathbb{R}^{2x2}$ such that, $S_{i, j}, T_{i, j}, U_{i, j} \in \{0,1, \cdots, 9\}$
How many of the products $S \cdot T \cdot U$ are invertible?
In the Sage reference for permutation I couldn't find any thing.
Thanks
PS: The curly braces couldn't be escaped properly in the LaTex part ... \\{0,1, \cdots, 9\\}AsgFri, 15 Dec 2017 11:34:07 -0600http://ask.sagemath.org/question/40180/permutations with propertyhttp://ask.sagemath.org/question/37155/permutations-with-property/ How can I get a list of permutations $\sigma \in \mathfrak{S}_n$ with the property that $\sigma(i) \geq i-1$ for all $i =1, dots, n.$AhmedMon, 03 Apr 2017 15:41:41 -0500http://ask.sagemath.org/question/37155/Changing a 1-line permutation to a string 'blablabla'http://ask.sagemath.org/question/36828/changing-a-1-line-permutation-to-a-string-blablabla/ Hello, guys. First of all I'm very new to Sage, and also this forum, so please be generous to my question..
So, I was wondering given a permutation, say
Permutation([1,2,3,4])
how can I change to a string of the form
'1234'
??
Thank you for any help.sssageeeeSat, 04 Mar 2017 13:40:53 -0600http://ask.sagemath.org/question/36828/Transposing a Permutatoinhttp://ask.sagemath.org/question/32498/transposing-a-permutatoin/ So I'm trying to take a permutation from a subgroup and add 5 to every digit in the permutation. For example if G=SymmetricGroup[5], G[2]=(1,2,3,4,5) , then I want the symmetric group isomorphic to G but where the 2nd element is (6,7,8,9,10). I also want to do this for arbitrary permutation groups, not just the symmetric groups.kvissuetMon, 08 Feb 2016 10:09:50 -0600http://ask.sagemath.org/question/32498/Need to shift a permutation (1,2,3)(4,5)->(6,7,8)(9,10)http://ask.sagemath.org/question/32499/need-to-shift-a-permutation-12345-678910/So I've been trying to shift a permutation group upwards to be able to make a cartesian product of two arbitrary permutation groups into a permutation group. My idea was to simply shift one permutation group up enough so that it commutes with the other. However I am stuck trying to figure out how to shift it up, i.e. add 5 to each number in the permutation. Anyone have any ideas?
ThankskvissuetMon, 08 Feb 2016 10:25:37 -0600http://ask.sagemath.org/question/32499/Counting cycles of induced permutationshttp://ask.sagemath.org/question/31888/counting-cycles-of-induced-permutations/In order to do some sophisticated counting in graph theory, I need to count the cycles of some particular permutations.
In my situation, $n$ is an integer greater than 1, and $K_n$ is the set of all two-element sets {a,b} with $a, b$ being integers not greater than $n$. Now any element $\pi$ of the symmetric group $S_n$ induces a permutation $\overline{\pi}$ of $K_n$ in a natural way, i.e. $\overline{\pi}$ maps any set {a,b} of $K_n$ onto {$\pi(a)$, $\pi(b)$}. What I want to figure out with the help of SAGE is the number of cycles that the permutation $\overline{\pi}$ has.
If you can help me, please do not forget to mention those little extra things that need to be done and that might appear obvious to you (e.g. importing packages and so forth), since I am a relative novice to SAGE.
Thank you very much.
MalteMalteMon, 28 Dec 2015 10:56:15 -0600http://ask.sagemath.org/question/31888/the permutation of subscripts of a multivariate polynomialhttp://ask.sagemath.org/question/23385/the-permutation-of-subscripts-of-a-multivariate-polynomial/ I want to define a function, the input are a permutation sigma belonging to Sn, and a multivariate polynomial f=f(x1,x2,...,xn) over Q, and the output is a multivariate polynomial f=f(x(sigma(1)),x(sigma(2)),...,x(sigma(n))),
for example, if sigma=(3,1,2),f=x1+x2*x3, then the output should be f=x3+x1*x2.
It is worth mentioning that this should work for any n not just when n=3.
How should I do that?ruidongshuai@gmail.comSat, 12 Jul 2014 09:32:22 -0500http://ask.sagemath.org/question/23385/Permutations indexed from zerohttp://ask.sagemath.org/question/23402/permutations-indexed-from-zero/Is there an option to have permutations indexed from zero instead of one, in other words can we have permutations on the integers 0 to n-1 instead of permutations on the integers 1 to n. This would be useful since indexation for lists, tuples, and iterables in general is usually from zero. Indices for variable names of generators of various algebraic structures, such as multivariate polynomial rings, finitely presented groups, etc., also start from zero.
I saw that `PermutationOptions` lets you choose how to display permutations, and whether to multiply them from left to right or right to left, but found nothing about having indices starting from zero versus one.
slelievreSun, 13 Jul 2014 12:10:27 -0500http://ask.sagemath.org/question/23402/Generating permutations of coefficientshttp://ask.sagemath.org/question/10229/generating-permutations-of-coefficients/I have created the following function to return all pairs `(n, k)` such that a slightly altered binomial coefficient is less than or equal to a certain `N`:
bin = lambda n, k : binomial(n + k - 1, k)
def nkfilter(N):
pairs = []
for n in range(2, N+1):
for k in range(1, n):
if bin(n, k) <= N:
pairs.append([n, k])
print '\n (n, k)\n'
return pairs
This prints out the following:
example = nkfilter(8); print example
(n, k)
[[2, 1], [3, 1], [3, 2], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1]]
I now would like to take this `n` and generate a tuple of length `n`: `(a_1,..., a_n)`, for which all the `a_i`s are less than or equal to `k`. I have been considering `permutations` to accomplish this, but I believe I need to first generate `list_of_numbers_less_than_k` and then take `permutations(n, list_of_numbers)`.
However I am not sure which data types to use, and how to generate these `n`-length tuples. JoshIzzardThu, 13 Jun 2013 04:57:57 -0500http://ask.sagemath.org/question/10229/Finding the permutation that sorts a listhttp://ask.sagemath.org/question/9948/finding-the-permutation-that-sorts-a-list/Given a list (say, of numbers) `L`, the method `L.sort()` will put its elements in order. The function `sorted(L)` returns a new list with the elements of `L` in order. I would like a version of `sorted` that will not return the elements of `L` in sorted order, but rather, the *permutation* that puts them in sorted order. Does this exist in Sage? Thanks.Ed ScheinermanWed, 27 Mar 2013 13:44:08 -0500http://ask.sagemath.org/question/9948/Assigning students in groupshttp://ask.sagemath.org/question/9871/assigning-students-in-groups/I have a project with 60 students and 6 teachers. I'd like to know if it is possible to use Matrix and Permutation functions in Sage to assign those 60 students in 6 groups. There would be 6 sessions (a month each). Each student has to work once with each teacher and avoid being in the same group of students (as much as possible).
Thank you.KaiserfilkSun, 03 Mar 2013 11:03:06 -0600http://ask.sagemath.org/question/9871/Orbits on group actions acting on setshttp://ask.sagemath.org/question/9652/orbits-on-group-actions-acting-on-sets/Hello!
I am wondering how to solve the following problem efficiently.
I have a Permuation Group $G$ acting on $A = \{1,\ldots,n\}$ and I wish to compute the orbits of $G$ but not the ones of $G$ acting on $A$ but rather for $G$ acting on some $S \subseteq A \times A$ in the natural way. That is if $g \in G$ and $ x = \{a,b\} \in S$ then $x^g = {a^g,b^g\} \in S$
Other software for permuation groups (magma, gap) allows to do this by specifing an additional option "on sets/on tuples" to compute the specifed orbits.
I am wondering how could I do the same in sage, given a permuation group $G$ and an $S$ as described above.
Thanks!SGQWed, 26 Dec 2012 03:56:11 -0600http://ask.sagemath.org/question/9652/Permutation Representations and the Modular Grouphttp://ask.sagemath.org/question/9202/permutation-representations-and-the-modular-group/Hi!
Given a congruence subgroup of the modular group G = SL2Z, how can one use Sage to find the permutation representations of G on the cosets of each of those normal subgroups? Specifically I am looking at the subgroups on page 22 here: http://arxiv.org/pdf/1201.3633v2.pdf
Many thanks!
JimereeFri, 03 Aug 2012 04:19:42 -0500http://ask.sagemath.org/question/9202/calculating n!/(n-k)! for k-permutationshttp://ask.sagemath.org/question/8767/calculating-nn-k-for-k-permutations/I was wondering if there is a way to calculate n!/(n-k)! in sage without using the factorial(n) method for n and n-k and then dividing.johnsa5Sat, 03 Mar 2012 09:40:33 -0600http://ask.sagemath.org/question/8767/