PREP Quickstart, Abstract Algebra
system:sage


<h1 style="font-size: 2em;">Sage Quickstart for Abstract Algebra</h1>
<p>This&nbsp;<a href="http://www.sagemath.org" target="_blank">Sage</a>&nbsp;worksheet was developed for the MAA PREP Workshop "Sage: Using Open-Source Mathematics Software with Undergraduates" (funding provided by NSF DUE 0817071).</p>
<p>As computers are discrete and finite, anything with a discrete, finite set of generators is natural to implement and explore.</p>
<h2><span style="color: #ff0000;">Group Theory</span></h2>
<p>Many common groups are pre-defined, usually as permutation groups.&nbsp; They are not always easy to find.&nbsp; But every group of order 15 or less is available as a permutation group.</p>

{{{id=1|
G = QuaternionGroup()
G
///
}}}

{{{id=2|
H = AlternatingGroup(5)
H
///
}}}

{{{id=3|
H.is_simple()
///
}}}

{{{id=4|
D = DihedralGroup(8)
D
///
}}}

<p>Notice that we can access a lot of information - such a list of subgroups up to conjugacy, or a stabilizer, or other things demonstrated below.</p>

{{{id=5|
for K in D.conjugacy_classes_subgroups():
    print K
///
}}}

{{{id=8|
D.stabilizer(3)
///
}}}

{{{id=6|
for K in D.normal_subgroups():
    print K
///
}}}

{{{id=7|
L = D.subgroup(["(1,3,5,7)(2,4,6,8)"])
///
}}}

{{{id=9|
L.is_normal(D)
///
}}}

{{{id=10|
Q=D.quotient(L)
Q
///
}}}

{{{id=11|
Q.is_isomorphic(KleinFourGroup())
///
}}}

<p>There are some matrix groups as well, both finite and infinite.</p>

{{{id=12|
S = SL(2, GF(3))
S
///
}}}

{{{id=14|
for a in S:
    print a, "\n"
///
}}}

{{{id=15|
SS = SL(2, ZZ)
///
}}}

<p>Of course, you have to be careful what you try to do!</p>

{{{id=16|
SS.list()
///
}}}

{{{id=17|
for a in SS.gens():
    print a, "\n"
///
}}}

<h2><span style="color: #ff0000;">Rings</span></h2>

<p>Sage has many pre-defined rings to experiment with.</p>

<p>$\ZZ_{12}$</p>

{{{id=20|
twelve = Integers(12)
twelve
///
}}}

{{{id=25|
twelve.is_field()
///
}}}

{{{id=23|
twelve.is_integral_domain()
///
}}}

<h4>Quaternions, and generalizations</h4>
<p>$i^2=?$, $j^2=?$, then $k=i\cdot j$, all over $\QQ$</p>

{{{id=24|
quat = QuaternionAlgebra(-1, -1)
quat
///
}}}

{{{id=26|
quat.is_field()
///
}}}

{{{id=30|
quat.is_commutative()
///
}}}

{{{id=31|
quat.is_division_algebra()
///
}}}

{{{id=32|
quat2 = QuaternionAlgebra(5, -7)
///
}}}

{{{id=33|
quat2.is_division_algebra()
///
}}}

{{{id=34|
quat2.is_field()
///
}}}

<h4><span style="color: #000000;">Polynomial Rings</span></h4>

{{{id=43|
reset('x') # This returns x to being a variable
(x^4 + 2*x).parent()
///
}}}

{{{id=38|
R.<x>=QQ[]
R
///
}}}

{{{id=37|
R.random_element()
///
}}}

{{{id=40|
R.is_integral_domain()
///
}}}

{{{id=41|
(x^4 + 2*x).parent()
///
}}}

{{{id=59|
(x^2+x+1).is_irreducible()
///
}}}

{{{id=42|
F=GF(5)
P.<y>=F[]
///
}}}

{{{id=44|
P.random_element()
///
}}}

{{{id=45|
I=P.ideal(y^3+2*y)
I
///
}}}

{{{id=46|
Q=P.quotient(I)
///
}}}

{{{id=47|
Q
///
}}}

<h2><span style="color: #ff0000;">Fields</span></h2>
<p><span style="color: #ff0000;"><span style="color: #000000;">Support for finite fields and extensions of the rationals is superb.</span></span></p>
<h4><span style="color: #ff0000;"><span style="color: #000000;">Finite Fields<br /></span></span></h4>

{{{id=48|
F.<a> = GF(3^4)
F
///
}}}

<p>The generator satisfies a Conway polynomial, by default - or the polynomial can be specified.</p>

{{{id=50|
F.polynomial()
///
}}}

{{{id=51|
F.list()
///
}}}

{{{id=54|
(a^3 + 2*a^2 + 2)*(2*a^3 + 2*a + 1)
///
}}}

<p>$F$ should be the splitting field of the polynomial $x^{81}-x$, so no output from the following is a Good Thing (tm).</p>

{{{id=55|
for a in F:
    if not (a^81 - a == 0):
        print "Oops!"
///
}}}

<h4>Field Extensions, Number Fields</h4>

{{{id=56|
N = QQ[sqrt(2)]
N
///
}}}

{{{id=58|
var('z')
M.<a>=NumberField(z^2-2)
M
///
}}}

{{{id=60|
M.degree()
///
}}}

{{{id=61|
M.is_galois()
///
}}}

{{{id=62|
M.is_isomorphic(N)
///
}}}

{{{id=65|

///
}}}