Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News Sign UpSign In
| Download
Project: Course
Views: 47

Open sage.terminal, to get started type sage

To define Zn\mathbb{Z}_n in sage use Integers(n).

Note: pressing tab is for autocompletion, but it also can be used for discovring what sage hides. A very useful tip is to use ? after function name to get its documentation.

CyclicPermutationGroup?
File: /projects/sage/sage-6.10/local/lib/python2.7/site-packages/sage/groups/perm_gps/permgroup_named.py Signature : CyclicPermutationGroup(self, x, check=True) Docstring : A cyclic group of order n, as a permutation group. INPUT: n -- a positive integer Note: This group is also available via "groups.permutation.Cyclic()". EXAMPLES: sage: G = CyclicPermutationGroup(8) sage: G.order() 8 sage: G Cyclic group of order 8 as a permutation group sage: G.category() Category of finite permutation groups sage: TestSuite(G).run() sage: C = CyclicPermutationGroup(10) sage: C.is_abelian() True sage: C = CyclicPermutationGroup(10) sage: C.as_AbelianGroup() Multiplicative Abelian group isomorphic to C2 x C5

To define Zn\mathbb{Z}_n in sage use Integers(n).

Note: pressing tab is for autocompletion, but it also can be used for discovring what sage hides. A very useful tip is to use ? after function name to get its documentation.

Example:

Z = Integers(7) print Z.list() Z.addition_table() #This is a special example. Mainly, we will use G.cayley_table() #or G.cayley_table(names='elements') to use elements names
[0, 1, 2, 3, 4, 5, 6] + a b c d e f g +-------------- a| a b c d e f g b| b c d e f g a c| c d e f g a b d| d e f g a b c e| e f g a b c d f| f g a b c d e g| g a b c d e f

To define Dihedral group of order 2n2n, use DihedralGroup(n)

D = DihedralGroup(3) D
Dihedral group of order 6 as a permutation group
D.gens()
[(1,2,3), (1,3)]

The previous notation might looks alien to you, but we are going to study it in next lecture. It is very powerful.

r = D.gens()[0] s = D.gens()[1] print "r has an order: ", r.order(),"s has an order: ", s.order() print D.cayley_table(names='elements') print "In another form: " print D.cayley_table()
r has an order: 3 s has an order: 2 * () (1,3) (1,2,3) (2,3) (1,3,2) (1,2) +------------------------------------------------ ()| () (1,3) (1,2,3) (2,3) (1,3,2) (1,2) (1,3)| (1,3) () (2,3) (1,2,3) (1,2) (1,3,2) (1,2,3)| (1,2,3) (1,2) (1,3,2) (1,3) () (2,3) (2,3)| (2,3) (1,3,2) (1,2) () (1,3) (1,2,3) (1,3,2)| (1,3,2) (2,3) () (1,2) (1,2,3) (1,3) (1,2)| (1,2) (1,2,3) (1,3) (1,3,2) (2,3) () In another form: * a b c d e f +------------ a| a b c d e f b| b a d c f e c| c f e b a d d| d e f a b c e| e d a f c b f| f c b e d a
#Even fancier drawing D.cayley_graph().show()

We have not studied subgroups yet.

Defining subgroups is easy and natural in sage. Let G be a group, and H={e,a,a2,b,ab,,}H = \{e, a, a^2, b, ab,\dots, \} be a subgroup of G.

#Initialization G = SymmetricGroup(15) #Setting up a group r = G("(5,7,4,10)(1,8)") #Defining an element H = G.subgroup([r]) H
Subgroup of (Symmetric group of order 15! as a permutation group) generated by [(1,8)(4,10,5,7)]

You might enjoy playing with H.is_

H.is_abelian()
True
print H.center() print H.center().list()
Subgroup of (Subgroup of (Symmetric group of order 15! as a permutation group) generated by [(1,8)(4,10,5,7)]) generated by [(1,8)(4,10,5,7)] [(), (1,8)(4,10,5,7), (4,5)(7,10), (1,8)(4,7,5,10)]