maths.freeAbstract Algebra › 16. Rings › Sage

Sage

Rings are very important in your study of abstract algebra, and similarly, they are very important in the design and use of Sage.

Sage

Rings are very important in your study of abstract algebra, and similarly, they are very important in the design and use of Sage. There is a lot of material in this chapter, and there are many corresponding commands in Sage.

Creating Rings

Here is a list of various rings, domains and fields you can construct simply.

  1. Integers(), ZZ: the integral domain of positive and negative integers, \({\mathbb Z}\).

  2. Integers(n): the integers mod \(n\), \({\mathbb Z_n}\). A field when \(n\) is prime, but just a ring for composite \(n\).

  3. QQ: the field of rational numbers, \({\mathbb Q}\).

  4. RR, CC: the field of real numbers and the field of complex numbers, \({\mathbb R}\), \({\mathbb C}\). It is impossible to create every real number inside a computer, so technically these sets do not behave as fields, but only give a good imitiation of the real thing. We say they are inexact rings to make this point.

  5. QuadraticField(n): the field formed by combining the rationals with a solution to the polynomial equation \(x^2-n=0\). The notation in the text is \({\mathbb Q}[\sqrt{n}]\). A functional equivalent can be made with the syntax QQ[sqrt(n)]. Note that n can be negative.

  6. CyclotomicField(n): the field formed by combining the rationals with the solutions to the polynomial equation \(x^n-1=0\).

  7. QQbar: the field formed by combining the rationals with the solutions to every polynomial equation with integer coefficients. This is known as a the field of algebraic numbers, denoted as \(\overline{{\mathbb Q}}\).

  8. FiniteField(p): for a prime \(p\), the field of integers \({\mathbb Z_p}\).

If you print a description of some of the above rings, you will sometimes see a new symbol introduced. Consider the following example:

Here Number Field describes an object generally formed by combining the rationals with another number (here \(\sqrt{7}\)). a is a new symbol which behaves as a root of the polynomial \(x^2-7\). We do not say which root, \(\sqrt{7}\) or \(-\sqrt{7}\), and as we understand the theory better we will see that this does not really matter.

We can obtain this root as a generator of the number field, and then manipulate it. First squaring root yields 7. Notice that root prints as a. Notice, too, that computations with root behave as if it was either root of \(x^2-7\), and results print using a.

Condensed — the full section is in Judson, Abstract Algebra: Theory and Applications.

Properties of Rings

The examples below demonstrate how to query certain properties of rings. If you are playing along, be sure to execute the first compute cell to define the various rings involved in the examples.

Exact versus inexact.

Finite versus infinite.

Integral domain?

Field?

Commutative?

Characteristic.

Additive and multiplicative identities print like you would expect, but notice that while they may print identically, they could be different because of the ring they live in.

Condensed — the full section is in Judson, Abstract Algebra: Theory and Applications.

Quotient Structure

Ideals are the normal subgroups of rings and allow us to build quotients basically new rings defined on equivalence classes of elements of the original ring. Sage support for ideals is variable. When they can be created, there is not always a lot you can do with them. But they work well in certain very important cases.

The integers, \({\mathbb Z}\), have ideals that are just multiples of a single integer. We can create them with the .ideal() method or just by wrting a scalar multiple of ZZ. And then the quotient is isomorphic to a well-understood ring. (Notice that I is a bad name for an ideal if we want to work with complex numbers later.)

We might normally be more careful about the last statement. The quotient is a set of equivalence classes, each infinite, and certainly not a single integer. But the quotient is isomorphic to \({\mathbb Z}_4\), so Sage just makes this identification.

Notice that the construction of the quotient ring has created a new generator, converting y(\(y\)) to ybar (\(\overline{y}\)). We can override this as before with the syntax demonstrated below.

So from a quotient of an infinite ring and an ideal (which is also a ring), we create a field, which is finite. Understanding this construction will be an important theme in the next few chapters. To see how remarkable it is, consider what happens with just one little change.

There are a few methods available which will give us properties of ideals. In particular, we can check for prime and maximal ideals in rings of polynomials. Examine the results above and below in the context of .

The fact that M is a prime ideal is verification of .

Ring Homomorphisms

When Sage is presented with 3 + 4/3, how does it know that 3 is meant to be an integer? And then to add it to a rational, how does it know that we really want to view the computation as 3/1 + 4/3? This is really easy for you and me, but devilishly hard for a program, and you can imagine it getting ever more complicated with the many possible rings in Sage, subrings, matrices, etc. Part of the answer is that Sage uses ring homomorphisms to translate objects (numbers) between rings.

We will give an example below, but not pursue the topic much further. For the curious, reading the Sage documentation and experimenting would be a good exercise.

So phi is a homomorphism (morphism) that converts integers (the domain is ZZ) into rationals (the codomain is QQ), whose parent is a set of homomorphisms that Sage calls a homset. Even though a and b both print as 3, which is indistinguishable to our eyes, the parents of a and b are different. Yet the numerical value of the two objects has not changed.

Symbols used here

\sqrt{x},\ \sqrt[n]{x}
square root, n-th root
The non-negative number whose square (n-th power) is x.
\mathbb{N},\ \mathbb{Z},\ \mathbb{Q},\ \mathbb{R},\ \mathbb{C}
number sets
Naturals, integers, rationals, reals, complex numbers.
x \in A,\ A \subseteq B
element of, subset
x belongs to A; every element of A is in B.
\blacksquare\ \text{or}\ \square
end of proof (halmos)
Marks the point where the statement has been established.
a \equiv b \pmod n
congruent modulo n
n divides a − b; a and b have the same remainder.
a \mid b,\ \gcd(a,b)
divides, greatest common divisor
b is a multiple of a; the largest number dividing both.
(G, \cdot),\ e,\ g^{-1}
group, identity, inverse
A set with an operation; the do-nothing element; the element that undoes g.
G \cong H,\ G / N
isomorphic, quotient group
Same structure; the group of cosets of a normal subgroup N.
\mathbb{Z}/n\mathbb{Z},\ \mathbb{Z}_n
integers modulo n
The remainders 0…n−1 with clock arithmetic.
\operatorname{Hom}(A, B),\ f \circ g
arrows from A to B, composition
The set of morphisms; do g then f.

Questions people ask

What is a group, in plain words?

A set with one operation that is associative, has an identity, and lets every element be undone. Symmetries of any object form a group — that is where the idea came from.

What is the difference between a ring and a field?

A ring has addition and multiplication that behave like the integers (you cannot always divide); a field is a ring where every non-zero element has a reciprocal, like the rationals or the reals.

あなた自身を試してみてください

Parts of this page are adapted from Judson, Abstract Algebra: Theory and Applications (GFDL 1.3). Condensed and re-explained here; errors are ours.

ここに Abstract Algebra