Sage:
The goal of this short talk is to whet your appetite by giving you a quick overview of some algebra-related functionality in Sage.
(This is neither a Sage tutorial nor a Python tutorial.)
|
|
Incidence structure with 7 points and 7 blocks Incidence structure with 7 points and 7 blocks |
Python is an object-oriented language, and most of the functionality in Sage is centred around objects, such as our block design BD. To do something interesting with an object, we must access its methods:
Incidence structure with 7 points and 7 blocks Incidence structure with 7 points and 7 blocks |
To see what are the various methods implemented for block designs, one can read the corresponding chapter of the reference manual. A quicker way is to use tab-completion (press Tab after the . below):
Syntax Error:
BD. # press Tab after the .
Syntax Error:
BD. # press Tab after the .
|
We can visualise this design by looking at its incidence matrix:
[1 1 1 0 0 0 0] [1 0 0 1 1 0 0] [1 0 0 0 0 1 1] [0 1 0 1 0 1 0] [0 1 0 0 1 0 1] [0 0 1 1 0 0 1] [0 0 1 0 1 1 0] [1 1 1 0 0 0 0] [1 0 0 1 1 0 0] [1 0 0 0 0 1 1] [0 1 0 1 0 1 0] [0 1 0 0 1 0 1] [0 0 1 1 0 0 1] [0 0 1 0 1 1 0] |
|
|
Or we can look at the incidence graph:
|
|
What else can we do with the graph G?
Syntax Error:
G. # press Tab after .
Syntax Error:
G. # press Tab after .
|
336 336 |
Permutation Group with generators [(3,5)(4,6)(8,9)(12,13), (3,6)(4,5)(8,9)(10,11), (1,2)(5,6)(10,12)(11,13), (1,3)(2,4)(7,8)(11,12), (1,8)(2,9)(3,10)(4,11)(5,12)(6,13)(7,14), (1,14)(4,5)(8,10)(9,11)] Permutation Group with generators [(3,5)(4,6)(8,9)(12,13), (3,6)(4,5)(8,9)(10,11), (1,2)(5,6)(10,12)(11,13), (1,3)(2,4)(7,8)(11,12), (1,8)(2,9)(3,10)(4,11)(5,12)(6,13)(7,14), (1,14)(4,5)(8,10)(9,11)] |
The automorphism group A is represented as a group of permutations of the graph's vertices. Six generators might seem like a lot, so we wonder whether automorphism_group returns a minimal set of generators. We could look up the method in the reference manual; but there's an easier way:
|
|
One question mark gives us access to the method's docstring - which is very informative but doesn't answer the question we had about generators. This is where the fun begins:
|
|
Two question marks give us the source code of the method. Without getting more familiar with the algorithm, we still notice that some generators are computed and then the constructor PermutationGroup is called on them.
|
|
In a somewhat roundabout way, the description of the argument canonicalize suggests that no nontrivial work is done to obtain a minimal set of generators (which is a good thing because it is a potentially expensive operation that shouldn't be performed by default). Some more tab-completion allows us to discover:
|
|
[(1,8)(2,9)(3,11)(4,10)(5,13)(6,12)(7,14), (1,14,5,3,4,2,6)(7,9,10,8,13,12,11)] [(1,8)(2,9)(3,11)(4,10)(5,13)(6,12)(7,14), (1,14,5,3,4,2,6)(7,9,10,8,13,12,11)] |
Compare this to the original 6 generators:
[(3,5)(4,6)(8,9)(12,13), (3,6)(4,5)(8,9)(10,11), (1,2)(5,6)(10,12)(11,13), (1,3)(2,4)(7,8)(11,12), (1,8)(2,9)(3,10)(4,11)(5,12)(6,13)(7,14), (1,14)(4,5)(8,10)(9,11)] [(3,5)(4,6)(8,9)(12,13), (3,6)(4,5)(8,9)(10,11), (1,2)(5,6)(10,12)(11,13), (1,3)(2,4)(7,8)(11,12), (1,8)(2,9)(3,10)(4,11)(5,12)(6,13)(7,14), (1,14)(4,5)(8,10)(9,11)] |
|
|
[Permutation Group with generators [()], Permutation Group with generators [(3,5)(4,6)(8,9)(12,13), (3,6)(4,5)(8,9)(10,11), (2,6,3)(4,5,14)(7,11,10)(8,13,9), (1,5,4,6,14,3,2)(7,10,13,11,9,8,12)], Permutation Group with generators [(1,8)(2,9)(3,11)(4,10)(5,13)(6,12)(7,14), (1,14,5,3,4,2,6)(7,9,10,8,13,12,11)]] 3 [Permutation Group with generators [()], Permutation Group with generators [(3,5)(4,6)(8,9)(12,13), (3,6)(4,5)(8,9)(10,11), (2,6,3)(4,5,14)(7,11,10)(8,13,9), (1,5,4,6,14,3,2)(7,10,13,11,9,8,12)], Permutation Group with generators [(1,8)(2,9)(3,11)(4,10)(5,13)(6,12)(7,14), (1,14,5,3,4,2,6)(7,9,10,8,13,12,11)]] 3 |
|
|
Permutation Group with generators [(), (1,2)] Permutation Group with generators [(), (1,2)] |
True 168 True 168 |
Permutation Group with generators [(3,7,5)(4,8,6), (1,2,6)(3,4,8)] Permutation Group with generators [(3,7,5)(4,8,6), (1,2,6)(3,4,8)] |
True True |
Note that projective linear groups are implemented as permutation groups, however:
<class 'sage.groups.matrix_gps.special_linear.SpecialLinearGroup_finite_field'&\ gt; <class 'sage.groups.matrix_gps.special_linear.SpecialLinearGroup_finite_field'> |
Trivial Abelian Group Trivial Abelian Group |
Multiplicative Abelian Group isomorphic to C2 Multiplicative Abelian Group isomorphic to C2 |
We mentioned already that Sage glues together many specialised mathematical libraries. For instance, most of the group theory functionality in Sage uses GAP behind the scenes. Sometimes GAP packages are used, e.g. Graham Ellis' HAP for computing the cohomology groups given above.
There is a package for doing computations with the mod p cohomology rings of p-groups, due to Simon King and David Green. It can compute Poincaré series, Massey products, and more.
Let's leave groups aside for now, and see what else Sage knows about.
Multivariate Polynomial Ring in x, y, z over Rational Field Multivariate Polynomial Ring in x, y, z over Rational Field |
Syntax Error:
R. # tab-complete
Syntax Error:
R. # tab-complete
|
3 3 |
|
|
Syntax Error:
I. # tab-complete
Syntax Error:
I. # tab-complete
|
Of course, whenever we speak of computations with polynomial rings, we have:
[x^2 - y, x*z, y*z] [x^2 - y, x*z, y*z] |
A method that brings us closer to geometry:
[Ideal (y, x) of Multivariate Polynomial Ring in x, y, z over Rational Field, Ideal (z, x^2 - y) of Multivariate Polynomial Ring in x, y, z over Rational Field] [Ideal (y, x) of Multivariate Polynomial Ring in x, y, z over Rational Field, Ideal (z, x^2 - y) of Multivariate Polynomial Ring in x, y, z over Rational Field] |
Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (x^2 - y, x*z) Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (x^2 - y, x*z) |
(xbar, ybar, zbar) (xbar, ybar, zbar) |
Most of the multivariate polynomial functionality in Sage is based on Singular.
Sage has implementations for a lot of rings:
Most of these can be used as coefficients to construct univariate and multivariate polynomial rings, power series rings, rings of Laurent series and Laurent polynomials. There is also a way to construct the fraction field of an integral domain (but more general localisations are not yet implemented).
Ambient free module of rank 2 over the principal ideal domain Integer Ring Ambient free module of rank 2 over the principal ideal domain Integer Ring |
[ (1, 0), (0, 1) ] [ (1, 0), (0, 1) ] |
[ (1, -5) ] [ (1, -5) ] |
Sage also knows about morphisms, not just objects:
Set of Morphisms from Ambient free module of rank 2 over the principal ideal domain Integer Ring to Free module of degree 2 and rank 1 over Integer Ring Echelon basis matrix: [ 1 -5] in Category of free modules over Integer Ring Set of Morphisms from Ambient free module of rank 2 over the principal ideal domain Integer Ring to Free module of degree 2 and rank 1 over Integer Ring Echelon basis matrix: [ 1 -5] in Category of free modules over Integer Ring |
Free module morphism defined by the matrix [1] [0] Domain: Ambient free module of rank 2 over the principal ideal domain ... Codomain: Free module of degree 2 and rank 1 over Integer Ring Echelon ... Free module morphism defined by the matrix [1] [0] Domain: Ambient free module of rank 2 over the principal ideal domain ... Codomain: Free module of degree 2 and rank 1 over Integer Ring Echelon ... |
(3, -15) (3, -15) |
Say a few words about
|
|